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_chain_basics() -> std::io::Result<()> {
let source1: io::Cursor<Vec<u8>> = io::Cursor::new(vec![0, 1, 2]);
let source2: io::Cursor<Vec<u8>> = io::Cursor::new(vec![3, 4, 5]);
task::block_on(async move {
let mut buffer = Vec::new();
let mut source = source1.chain(source2);
assert_eq!(6, source.read_to_end(&mut buffer).await?);
assert_eq!(buffer, vec![0, 1, 2, 3, 4, 5]);
Ok(())
})
} | rust_cleaned_test_functions.jsonl/45549 | {
"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,
30583,
880,
67981,
368,
1464,
1460,
486,
815,
486,
2077,
71698,
341,
286,
1077,
2530,
16,
25,
6399,
486,
14543,
50439,
34837,
23,
2452,
284,
6399,
486,
14543,
486,
931,
25592,
20703,
15,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_primitive_array_negate() {
let a: Int64Array = (0..100).into_iter().map(Some).collect();
let actual = negate(&a).unwrap();
let expected: Int64Array = (0..100).into_iter().map(|i| Some(-i)).collect();
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/120284 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
28209,
349,
368,
341,
286,
1077,
264,
25,
1333,
21,
19,
1857,
284,
320,
15,
496,
16,
15,
15,
568,
18122,
11723,
1005,
2186,
65405,
568,
17384,
543,
286,
1077,
5042,
284,
71219,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_manifest_generation_binds() {
let mut m = Manifest {
pkg_ident: PackageIdent::from_str("core/nginx").unwrap(),
metadata_name: "nginx-latest".to_owned(),
image: "core/nginx:latest".to_owned(),
count: 3,
service_topology: Default::default(),
service_group: Some("group1".to_owned()),
config: None,
ring_secret_name: Some("deltaechofoxtrot".to_owned()),
binds: vec!["name1:service1.group1".parse().unwrap()],
persistent_storage: None,
environment: vec![],
};
let expected = include_str!("../tests/KubernetesManifestTestBinds.yaml");
let mut o = vec![];
m.generate(&mut o).unwrap();
let out = String::from_utf8(o).unwrap();
assert_eq!(out, expected);
} | rust_cleaned_test_functions.jsonl/32937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 422
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74269,
64191,
880,
8673,
368,
341,
286,
1077,
5206,
296,
284,
39361,
341,
310,
24793,
38399,
25,
16906,
28301,
486,
1499,
2895,
445,
2153,
69261,
1827,
15454,
3148,
310,
11160,
1269,
25,
330,
7356... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_graph_parse() {
let inputs = read_lines("data/day_12_sample.txt");
let (nodes, edges) = parse_cave_system(&inputs);
assert_eq!(nodes.len(), 6);
assert_eq!(edges.len(), inputs.len() * 2);
} | rust_cleaned_test_functions.jsonl/42446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
14738,
21039,
368,
341,
262,
1077,
11127,
284,
1349,
18323,
445,
691,
44739,
62,
16,
17,
17491,
3909,
797,
262,
1077,
320,
20008,
11,
12822,
8,
284,
4715,
666,
523,
17687,
2099,
24941,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_pitchgroup() {
let notes0 = [C(Natural), G(Flat)];
let result0 = PitchGroup::find(¬es0);
println!("Result 0: {:?}\n", &result0);
let notes1 = [C(Natural), A(Natural), D(Natural)];
let result1 = PitchGroup::find(¬es1);
println!("Result 1: {:?}\n", &result1);
let notes2 =
[B(Sharp), D(DoubleSharp), E(Sharp), F(DoubleSharp), A(Sharp)];
let result2 = PitchGroup::find(¬es2);
println!("Result 2: {:?}\n", &result2);
let notes3 = [C(Natural), F(Natural), G(Natural)];
let result3 = PitchGroup::find(¬es3);
println!("Result 3: {:?}\n", &result3);
let notes4 = [E(Natural), A(Natural), B(Natural)];
let result4 = PitchGroup::find(¬es4);
println!("Result 4: {:?}\n", &result4);
} | rust_cleaned_test_functions.jsonl/126566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
51959,
4074,
368,
341,
286,
1077,
8388,
15,
284,
508,
34,
8204,
4585,
701,
479,
7,
31019,
12587,
286,
1077,
1102,
15,
284,
45576,
2808,
486,
3903,
2099,
18286,
15,
317,
286,
13751,
17223,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_err_bad_swap() {
let tmp = create_temp_dir("test_err_bad_swap_v2").expect("create temp directory for test");
set_fixture(&tmp, CGROUP_MEMORY_MAX, "0").expect("set fixture for memory limit");
set_fixture(&tmp, CGROUP_MEMORY_LOW, "0").expect("set fixture for memory reservation");
set_fixture(&tmp, CGROUP_MEMORY_SWAP, "0").expect("set fixture for swap limit");
let memory_limits = &LinuxMemory {
limit: Some(512),
swap: Some(-3),
reservation: None,
kernel: None,
kernel_tcp: None,
swappiness: None,
};
let result = Memory::apply(&tmp, memory_limits);
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/79410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9266,
34199,
40991,
368,
341,
286,
1077,
4174,
284,
1855,
11771,
4334,
445,
1944,
9266,
34199,
40991,
2273,
17,
1827,
17119,
445,
3182,
2730,
6220,
369,
1273,
797,
286,
738,
74409,
2099,
5173,
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_metric_cache_ignore_shared_txns() {
let (mut smp, peers) = SharedMempoolNetwork::bootstrap_validator_network(2, 1);
let (peer_a, peer_b) = (peers.get(0).unwrap(), peers.get(1).unwrap());
let txns = vec![
TestTransaction::new(1, 0, 1),
TestTransaction::new(1, 1, 1),
TestTransaction::new(1, 2, 1),
];
smp.add_txns(
&peer_a,
vec![txns[0].clone(), txns[1].clone(), txns[2].clone()],
);
// Check if txns's creation timestamp exist in peer_a's metrics_cache.
assert_eq!(smp.exist_in_metrics_cache(&peer_a, &txns[0]), true);
assert_eq!(smp.exist_in_metrics_cache(&peer_a, &txns[1]), true);
assert_eq!(smp.exist_in_metrics_cache(&peer_a, &txns[2]), true);
// Let peer_a discover new peer_b.
smp.send_connection_event(
&peer_a,
ConnectionStatusNotification::NewPeer(*peer_b, Multiaddr::empty()),
);
for txn in txns.iter().take(3) {
// Let peer_a share txns with peer_b
let (_transaction, rx_peer) = smp.deliver_message(&peer_a);
// Check if txns's creation timestamp exist in peer_b's metrics_cache.
assert_eq!(smp.exist_in_metrics_cache(&rx_peer, txn), false);
}
} | rust_cleaned_test_functions.jsonl/31469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 558
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41294,
11529,
58493,
20405,
17805,
4412,
368,
341,
262,
1077,
320,
6984,
274,
1307,
11,
25029,
8,
284,
16990,
44,
3262,
1749,
12320,
486,
6281,
64959,
20966,
7,
17,
11,
220,
16,
317,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_headless() {
use glutin::{ContextBuilder, EventsLoop};
let dim = (256, 256, 8, AaMode::Multi(4));
let events_loop = EventsLoop::new();
let context = ContextBuilder::new()
.with_hardware_acceleration(Some(false))
.build_headless(&events_loop, (dim.0 as u32, dim.1 as u32).into())
.expect("Failed to build headless context");
let (_, mut device, _, _, _) = init_headless::<Rgba8, DepthStencil>(context, dim);
device.cleanup();
} | rust_cleaned_test_functions.jsonl/129992 | {
"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,
13138,
1717,
368,
341,
286,
990,
34069,
258,
22964,
1972,
3297,
11,
17627,
14620,
2315,
286,
1077,
5103,
284,
320,
17,
20,
21,
11,
220,
17,
20,
21,
11,
220,
23,
11,
362,
64,
3636,
486,
20358... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extend() {
let mut one_signal = SigSet::empty();
one_signal.add(SIGUSR1);
let mut two_signals = SigSet::empty();
two_signals.add(SIGUSR2);
two_signals.extend(&one_signal);
assert!(two_signals.contains(SIGUSR1));
assert!(two_signals.contains(SIGUSR2));
} | rust_cleaned_test_functions.jsonl/8925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70265,
368,
341,
286,
1077,
5206,
825,
21137,
284,
41560,
1649,
486,
3194,
543,
286,
825,
21137,
1364,
52516,
49558,
16,
626,
286,
1077,
5206,
1378,
76698,
284,
41560,
1649,
486,
3194,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_prefix() {
use repr::Timestamp;
fn record(offset: i64, predecessor: Option<i64>) -> CachedRecord {
CachedRecord {
offset,
predecessor,
timestamp: Timestamp::default(),
key: Vec::new(),
value: Default::default(),
}
}
for ((starting_offset, records), (expected_prefix, expected_remaining)) in vec![
((None, vec![]), (vec![], vec![])),
((None, vec![(1, None)]), (vec![(1, None)], vec![])),
(
(None, vec![(1, None), (2, Some(1))]),
(vec![(1, None), (2, Some(1))], vec![]),
),
// Three records with a gap.
(
(None, vec![(1, None), (2, Some(1)), (4, Some(2))]),
(vec![(1, None), (2, Some(1)), (4, Some(2))], vec![]),
),
(
(None, vec![(2, None), (2, Some(1))]),
(vec![(2, None)], vec![]),
),
(
(None, vec![(1, None), (2, Some(1)), (4, Some(3))]),
(vec![(1, None), (2, Some(1))], vec![(4, Some(3))]),
),
(
(
None,
vec![(1, None), (2, Some(1)), (4, Some(3)), (4, Some(2))],
),
(vec![(1, None), (2, Some(1)), (4, Some(2))], vec![]),
),
// Throw away a record whose data has already been accounted for.
((Some(2), vec![(1, None)]), (vec![], vec![])),
]
.drain(..)
{
// maybe some number of seeded shuffles?
let mut recs = records.iter().cloned().map(|(o, p)| record(o, p)).collect();
let prefix = extract_prefix(starting_offset, &mut recs);
assert_eq!(
(prefix, recs),
(
expected_prefix
.iter()
.cloned()
.map(|(o, p)| record(o, p))
.collect(),
expected_remaining
.iter()
.cloned()
.map(|(o, p)| record(o, p))
.collect()
)
);
}
} | rust_cleaned_test_functions.jsonl/60143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
13974,
368,
341,
262,
990,
30636,
486,
20812,
401,
262,
5168,
3255,
26245,
25,
600,
21,
19,
11,
39174,
25,
6959,
21897,
21,
19,
9231,
1464,
74205,
6471,
341,
286,
74205,
6471,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fixed_size_list_array() {
// Construct a value array
let value_data = ArrayData::builder(DataType::Int32)
.len(9)
.add_buffer(Buffer::from_slice_ref(&[0, 1, 2, 3, 4, 5, 6, 7, 8]))
.build();
// Construct a list array from the above two
let list_data_type = DataType::FixedSizeList(
Box::new(Field::new("item", DataType::Int32, false)),
3,
);
let list_data = ArrayData::builder(list_data_type.clone())
.len(3)
.add_child_data(value_data.clone())
.build();
let list_array = FixedSizeListArray::from(list_data);
let values = list_array.values();
assert_eq!(&value_data, values.data());
assert_eq!(DataType::Int32, list_array.value_type());
assert_eq!(3, list_array.len());
assert_eq!(0, list_array.null_count());
assert_eq!(6, list_array.value_offset(2));
assert_eq!(3, list_array.value_length());
assert_eq!(
0,
list_array
.value(0)
.as_any()
.downcast_ref::<Int32Array>()
.unwrap()
.value(0)
);
for i in 0..3 {
assert!(list_array.is_valid(i));
assert!(!list_array.is_null(i));
}
// Now test with a non-zero offset
let list_data = ArrayData::builder(list_data_type)
.len(3)
.offset(1)
.add_child_data(value_data.clone())
.build();
let list_array = FixedSizeListArray::from(list_data);
let values = list_array.values();
assert_eq!(&value_data, values.data());
assert_eq!(DataType::Int32, list_array.value_type());
assert_eq!(3, list_array.len());
assert_eq!(0, list_array.null_count());
assert_eq!(
3,
list_array
.value(0)
.as_any()
.downcast_ref::<Int32Array>()
.unwrap()
.value(0)
);
assert_eq!(6, list_array.value_offset(1));
assert_eq!(3, list_array.value_length());
} | rust_cleaned_test_functions.jsonl/3841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37839,
2368,
2019,
3858,
368,
341,
286,
442,
18678,
264,
897,
1334,
198,
286,
1077,
897,
1769,
284,
2910,
1043,
486,
17850,
63941,
486,
1072,
18,
17,
340,
310,
659,
2892,
7,
24,
340,
310,
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... | 2 |
#[test]
fn test_initialize_with_nonexistent_process() {
let process = Process::new(10000).expect("Failed to initialize process");
let version = get_ruby_version(&process);
match version
.unwrap_err()
.root_cause()
.downcast_ref::<AddressFinderError>()
.unwrap()
{
&AddressFinderError::NoSuchProcess(10000) => {}
_ => assert!(false, "Expected NoSuchProcess error"),
}
} | rust_cleaned_test_functions.jsonl/90830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40889,
6615,
21637,
64085,
11305,
368,
341,
286,
1077,
1882,
284,
8603,
486,
931,
7,
16,
15,
15,
15,
15,
568,
17119,
445,
9408,
311,
9468,
1882,
797,
286,
1077,
2319,
284,
633,
1710,
20028,
94... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rev_words_on_lines() {
// we include them.
let tests = [("", ""),
("a", "a"),
("a b", "b a"),
("cat dog", "dog cat"),
// compressed into a single space.
("cat dog", "dog cat"),
("cat dog frog", "frog dog cat"),
// Multiple Lines
("a b\nb a", "b a\na b"),
("a b\nc d\ne f", "b a\nd c\nf e")];
for &(input, expected) in tests.iter() {
let output = rev_words_on_lines(input);
assert!(expected.equiv(&output));
}
} | rust_cleaned_test_functions.jsonl/15903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38082,
18981,
4470,
18323,
368,
341,
1066,
262,
442,
582,
2924,
1105,
624,
262,
1077,
7032,
284,
508,
19814,
72712,
338,
3489,
64,
497,
330,
64,
4461,
338,
3489,
64,
293,
497,
330,
65,
264,
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... | 2 |
#[test]
fn test_sample_check_cardinality() {
let res = sample_check_cardinality(
vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].into_iter(),
|idx| idx % 2 == 0,
10_000,
100_000,
);
assert!(res)
} | rust_cleaned_test_functions.jsonl/16011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17491,
7200,
16888,
80777,
368,
341,
286,
1077,
592,
284,
6077,
7200,
16888,
80777,
1006,
310,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cached_executors() {
let key1 = solana_sdk::pubkey::new_rand();
let key2 = solana_sdk::pubkey::new_rand();
let key3 = solana_sdk::pubkey::new_rand();
let key4 = solana_sdk::pubkey::new_rand();
let executor: Arc<dyn Executor> = Arc::new(TestExecutor {});
let mut cache = CachedExecutors::new(3, 0);
cache.put(&[(&key1, executor.clone())]);
cache.put(&[(&key2, executor.clone())]);
cache.put(&[(&key3, executor.clone())]);
assert!(cache.get(&key1).is_some());
assert!(cache.get(&key2).is_some());
assert!(cache.get(&key3).is_some());
assert!(cache.get(&key1).is_some());
assert!(cache.get(&key1).is_some());
assert!(cache.get(&key2).is_some());
cache.put(&[(&key4, executor.clone())]);
assert!(cache.get(&key4).is_some());
let num_retained = [&key1, &key2, &key3]
.iter()
.filter_map(|key| cache.get(key))
.count();
assert_eq!(num_retained, 2);
assert!(cache.get(&key4).is_some());
assert!(cache.get(&key4).is_some());
assert!(cache.get(&key4).is_some());
cache.put(&[(&key3, executor.clone())]);
assert!(cache.get(&key3).is_some());
let num_retained = [&key1, &key2, &key4]
.iter()
.filter_map(|key| cache.get(key))
.count();
assert_eq!(num_retained, 2);
} | rust_cleaned_test_functions.jsonl/28963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 746
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64369,
18430,
9475,
368,
341,
286,
1077,
1376,
16,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
1376,
17,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_to_value() {
let mut sort = HashMap::new();
sort.insert("first_name".to_string(), SortDirection::Desc);
let mut query = FindQuery::find_all();
query.limit = Some(10);
query.skip = Some(20);
query.sort = vec![SortSpec::Complex(sort)];
let json = query.to_string();
assert_eq!(
r#"{"limit":10,"selector":{"_id":{"$ne":null}},"skip":20,"sort":[{"first_name":"desc"}]}"#,
json
)
} | rust_cleaned_test_functions.jsonl/40405 | {
"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,
34910,
2346,
3142,
368,
341,
286,
1077,
5206,
3378,
284,
10528,
486,
931,
543,
286,
3378,
7030,
445,
3896,
1269,
3263,
983,
3904,
1507,
15967,
9268,
486,
11065,
626,
286,
1077,
5206,
3239,
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_mixed_alloc() {
let mut lin = LinearAllocator::new(100_000);
let mut sc = ScopeStack::new(&mut lin);
let mut count = 0;
for _ in 0..6 {
unsafe {
let a = sc.alloc_obj::<TestObj>().unwrap();
std::ptr::write(
a.as_ptr(),
TestObj {
res: NonNull::new_unchecked((&mut count) as *mut _),
},
);
let _b = sc.alloc_pod::<TestPod>().unwrap();
}
}
assert_eq!(0, count, "Expected count to be untouched");
drop(sc);
assert_eq!(6, count);
} | rust_cleaned_test_functions.jsonl/107400 | {
"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,
717,
3286,
14802,
368,
341,
286,
1077,
5206,
9805,
284,
28263,
42730,
486,
931,
7,
16,
15,
15,
62,
15,
15,
15,
317,
286,
1077,
5206,
1136,
284,
34920,
4336,
486,
931,
2099,
6984,
9805,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_chunks_exact_remainder() {
let v: &[i32] = &[0, 1, 2, 3, 4];
let c = v.chunks_exact(2);
assert_eq!(c.remainder(), &[4]);
} | rust_cleaned_test_functions.jsonl/9634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65470,
71084,
86607,
1107,
368,
341,
262,
1077,
348,
25,
44590,
72,
18,
17,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
1077,
272,
284,
348,
5329,
152... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_decode_strh_reg() {
assert_eq!(
decode_16(0x5274),
Instruction::STRH_reg {
params: Reg3FullParams {
rt: Reg::R4,
rn: Reg::R6,
rm: Reg::R1,
index: true,
add: true,
wback: false,
shift_n: 0,
shift_t: SRType::LSL,
},
thumb32: false,
}
);
} | rust_cleaned_test_functions.jsonl/64781 | {
"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,
15227,
2895,
71,
4920,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
16,
21,
7,
15,
87,
20,
17,
22,
19,
1326,
286,
29051,
486,
6666,
39,
4920,
341,
310,
3628,
25,
3184,
18,
9432,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rsplitnator() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
assert_eq!(xs.rsplitn(1, |x| *x % 2 == 0).collect::<Vec<_>>(), splits);
let splits: &[&[_]] = &[&[5], &[1, 2, 3]];
assert_eq!(xs.rsplitn(2, |x| *x % 2 == 0).collect::<Vec<_>>(), splits);
let splits: &[&[_]] = &[&[], &[], &[], &[1, 2]];
assert_eq!(xs.rsplitn(4, |_| true).collect::<Vec<_>>(), splits);
let xs: &[i32] = &[];
let splits: &[&[i32]] = &[&[]];
assert_eq!(xs.rsplitn(2, |x| *x == 5).collect::<Vec<&[i32]>>(), splits);
assert!(xs.rsplitn(0, |x| *x % 2 == 0).next().is_none());
} | rust_cleaned_test_functions.jsonl/12898 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
6960,
77,
850,
368,
341,
262,
1077,
11943,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
4821,
262,
1077,
40467,
25,
44590,
5,
13496,
5053,
284,
44590,
5,
58,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fvm_extractor_empty_fvm() {
let store_dir = tempdir().unwrap();
let uri = store_dir.into_path().into_os_string().into_string().unwrap();
let model = Arc::new(DataModel::connect(uri).unwrap());
let fvm_controller = FvmExtractController::default();
let input_dir = tempdir().unwrap();
let input_path = input_dir.path().join("empty-fvm");
let output_dir = tempdir().unwrap();
let output_path = output_dir.path();
let request = FvmExtractRequest {
input: input_path.to_str().unwrap().to_string(),
output: output_path.to_str().unwrap().to_string(),
};
let query = serde_json::to_value(request).unwrap();
let response = fvm_controller.query(model, query);
assert_eq!(response.is_ok(), false);
} | rust_cleaned_test_functions.jsonl/39216 | {
"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,
761,
7338,
89821,
15124,
761,
7338,
368,
341,
286,
1077,
3553,
4334,
284,
2730,
3741,
1005,
15454,
543,
286,
1077,
13071,
284,
3553,
4334,
39860,
2638,
1005,
18122,
29387,
3904,
1005,
18122,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_select_query_with_conditions() {
let query = query_builder::select("users")
.fields(&["id", "name"])
.filter("id = $1")
.filter("name = $2")
.build();
assert_eq!("SELECT id, name FROM users WHERE id = $1 AND name = $2;", query);
} | rust_cleaned_test_functions.jsonl/93980 | {
"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,
13051,
5738,
6615,
54099,
368,
341,
286,
1077,
3239,
284,
3239,
28532,
486,
1742,
445,
4218,
1138,
310,
659,
9007,
2099,
1183,
307,
497,
330,
606,
14108,
310,
659,
5315,
445,
307,
284,
400,
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_repo_arg_with_git_clone() {
let test_env = TestEnvironment::default();
let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["git", "clone", "-R=.", "remote"]);
insta::assert_snapshot!(stderr, @r###"
Error: '--repository' cannot be used with 'git clone'
"###);
} | rust_cleaned_test_functions.jsonl/77489 | {
"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,
37784,
6057,
6615,
68801,
54742,
368,
341,
262,
1077,
1273,
15879,
284,
3393,
12723,
486,
2258,
543,
262,
1077,
26436,
284,
1273,
15879,
1169,
73,
11684,
43618,
8623,
15879,
9265,
12993,
1507,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_array_get_value_index_out_of_bound() {
let values: [u8; 12] = [
b'h', b'e', b'l', b'l', b'o', b'p', b'a', b'r', b'q', b'u', b'e', b't',
];
let offsets: [i32; 4] = [0, 5, 5, 12];
let array_data = ArrayData::builder(DataType::Utf8)
.len(3)
.add_buffer(Buffer::from(offsets.to_byte_slice()))
.add_buffer(Buffer::from(&values[..]))
.build();
let string_array = StringArray::from(array_data);
string_array.value(4);
} | rust_cleaned_test_functions.jsonl/11628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
3858,
3062,
3142,
3560,
6068,
3575,
19447,
368,
341,
286,
1077,
2750,
25,
508,
84,
23,
26,
220,
16,
17,
60,
284,
2278,
310,
293,
38882,
516,
293,
47868,
516,
293,
63866,
516,
293,
63866,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_occupied_neighbours() {
let pd = PocketDimension::new3(&Pos3(0,0,0), test_grid());
assert_eq!(pd.occupied_neighbours(&Pos3(0,0,0)), 1);
assert_eq!(pd.occupied_neighbours(&Pos3(1,2,0)), 3);
} | rust_cleaned_test_functions.jsonl/76748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
40356,
13925,
52117,
368,
341,
286,
1077,
7744,
284,
45724,
26121,
486,
931,
18,
2099,
4859,
18,
7,
15,
11,
15,
11,
15,
701,
1273,
15604,
1423,
286,
2060,
10714,
10297,
15360,
13,
40356,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_skewness() {
let skewness = |x: FisherSnedecor| x.skewness().unwrap();
test_almost(0.1, 10.0, 15.78090735784977089658, 1e-14, skewness);
test_case(1.0, 10.0, 5.773502691896257645091, skewness);
test_case(10.0, 10.0, 3.614784456460255759501, skewness);
} | rust_cleaned_test_functions.jsonl/42684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33811,
365,
2090,
368,
341,
286,
1077,
40543,
2090,
284,
760,
87,
25,
35504,
50,
18694,
757,
269,
91,
856,
39454,
365,
2090,
1005,
15454,
543,
286,
1273,
94418,
7,
15,
13,
16,
11,
220,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_versions_from_slice_max() {
assert_eq!(Err(ProtoverError::ExceedsMax), ProtoSet::from_slice(&[(4294967295, 4294967295)]));
} | rust_cleaned_test_functions.jsonl/105773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65148,
5673,
26488,
6345,
368,
341,
286,
2060,
10714,
10297,
7747,
7,
31549,
423,
1454,
486,
840,
4635,
82,
5974,
701,
57677,
1649,
486,
1499,
26488,
2099,
9697,
19,
17,
24,
19,
24,
21,
22,
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 |
#[test]
fn test_unresolved_type_error() {
insta::assert_display_snapshot!(compilation_errors(
"\n\nfn main() {\nlet a = Foo{};\n\nlet b = Bar{};\n}"
));
} | rust_cleaned_test_functions.jsonl/21695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
39747,
1819,
4096,
368,
341,
286,
1761,
64,
486,
2207,
14825,
53265,
10297,
5689,
13455,
20196,
1006,
310,
2917,
77,
1699,
8822,
1887,
368,
28152,
77,
1149,
264,
284,
33428,
6257,
17882,
77,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_echo_deconstruct() {
let packet = Packet::new_unchecked(&ECHO_PACKET_BYTES[..]);
assert_eq!(packet.msg_type(), Message::EchoRequest);
assert_eq!(packet.msg_code(), 0);
assert_eq!(packet.checksum(), 0x19b3);
assert_eq!(packet.echo_ident(), 0x1234);
assert_eq!(packet.echo_seq_no(), 0xabcd);
assert_eq!(packet.payload(), &ECHO_PACKET_PAYLOAD[..]);
assert_eq!(packet.verify_checksum(&MOCK_IP_ADDR_1, &MOCK_IP_ADDR_2), true);
assert!(!packet.msg_type().is_error());
} | rust_cleaned_test_functions.jsonl/76450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68628,
2259,
7596,
368,
341,
286,
1077,
10151,
284,
28889,
486,
931,
4907,
7549,
2099,
36,
30498,
40328,
40705,
95874,
2558,
286,
2060,
10714,
10297,
24829,
15137,
1819,
1507,
4856,
486,
74994,
1900... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rchunks_mut_last() {
let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5];
let c = v.rchunks_mut(2);
assert_eq!(c.last().unwrap(), &[0, 1]);
let v2: &mut [i32] = &mut [0, 1, 2, 3, 4];
let c2 = v2.rchunks_mut(2);
assert_eq!(c2.last().unwrap(), &[0]);
} | rust_cleaned_test_functions.jsonl/9672 | {
"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,
1710,
84263,
29523,
12195,
368,
341,
262,
1077,
348,
25,
609,
6984,
508,
72,
18,
17,
60,
284,
609,
6984,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_all_refs_for_local() {
check(
r#"
fn main() {
let mut i = 1;
let j = 1;
i = i<|> + j;
{
i = 0;
}
i = 5;
}"#,
expect![[r#"
i Local FileId(0) 24..25 Other Write
FileId(0) 50..51 Other Write
FileId(0) 54..55 Other Read
FileId(0) 76..77 Other Write
FileId(0) 94..95 Other Write
"#]],
);
} | rust_cleaned_test_functions.jsonl/47769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
60638,
5478,
13564,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
8822,
1887,
368,
341,
262,
1077,
5206,
600,
284,
220,
16,
280,
262,
1077,
502,
284,
220,
16,
280,
262,
600,
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_public_encrypt() {
let k0 = super::Rsa::generate(512).unwrap();
let k0pkey = k0.private_key_to_pem().unwrap();
let k1 = super::Rsa::private_key_from_pem(&k0pkey).unwrap();
let msg = vec![0xdeu8, 0xadu8, 0xd0u8, 0x0du8];
let mut emesg = vec![0; k0.size() as usize];
k0.public_encrypt(&msg, &mut emesg, Padding::PKCS1).unwrap();
let mut dmesg = vec![0; k1.size() as usize];
let len = k1
.private_decrypt(&emesg, &mut dmesg, Padding::PKCS1)
.unwrap();
assert_eq!(msg, &dmesg[..len]);
} | rust_cleaned_test_functions.jsonl/28562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27074,
66593,
368,
341,
286,
1077,
595,
15,
284,
2256,
486,
49,
9081,
486,
19366,
7,
20,
16,
17,
568,
15454,
543,
286,
1077,
595,
15,
79,
792,
284,
595,
15,
61603,
3097,
2346,
620,
336,
1005... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_session_default_timestamp_and_sid() {
let json = r#"{
"started": "2020-02-07T14:16:00Z",
"attrs": {
"release": "sentry-test@1.0.0"
}
}"#;
let parsed = SessionUpdate::parse(json.as_bytes()).unwrap();
assert!(!parsed.session_id.is_nil());
} | rust_cleaned_test_functions.jsonl/4848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12316,
9993,
23073,
8378,
53044,
368,
341,
286,
1077,
2951,
284,
435,
55543,
515,
220,
330,
46723,
788,
330,
17,
15,
17,
15,
12,
15,
17,
12,
15,
22,
51,
16,
19,
25,
16,
21,
25,
15,
15,
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_out() {
let mut ss = SimpleStore::new();
let tup = tuple![E::S("test content".to_string())];
assert!(ss.out(tup).is_ok())
} | rust_cleaned_test_functions.jsonl/74946 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6068,
368,
341,
262,
1077,
5206,
10870,
284,
8993,
6093,
486,
931,
543,
262,
1077,
57385,
284,
14405,
20703,
36,
486,
50,
445,
1944,
2213,
3263,
983,
3904,
2140,
935,
262,
2060,
10297,
778,
2532... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_d_0() {
test_add(
TimeGranularity::Days,
0,
"2000-01-01T00:00:00.0",
"2000-01-01T00:00:00.0",
);
} | rust_cleaned_test_functions.jsonl/134027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
814,
62,
15,
368,
341,
286,
1273,
2891,
1006,
310,
4120,
90723,
28979,
486,
20557,
345,
310,
220,
15,
345,
310,
330,
17,
15,
15,
15,
12,
15,
16,
12,
15,
16,
51,
15,
15,
25,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_contains_primitive_primitive() {
// OK
let f1 = Type::primitive_type_builder("f", PhysicalType::INT32)
.build()
.unwrap();
let f2 = Type::primitive_type_builder("f", PhysicalType::INT32)
.build()
.unwrap();
assert!(f1.check_contains(&f2));
// OK: different logical type does not affect check_contains
let f1 = Type::primitive_type_builder("f", PhysicalType::INT32)
.with_converted_type(ConvertedType::UINT_8)
.build()
.unwrap();
let f2 = Type::primitive_type_builder("f", PhysicalType::INT32)
.with_converted_type(ConvertedType::UINT_16)
.build()
.unwrap();
assert!(f1.check_contains(&f2));
// KO: different name
let f1 = Type::primitive_type_builder("f1", PhysicalType::INT32)
.build()
.unwrap();
let f2 = Type::primitive_type_builder("f2", PhysicalType::INT32)
.build()
.unwrap();
assert!(!f1.check_contains(&f2));
// KO: different type
let f1 = Type::primitive_type_builder("f", PhysicalType::INT32)
.build()
.unwrap();
let f2 = Type::primitive_type_builder("f", PhysicalType::INT64)
.build()
.unwrap();
assert!(!f1.check_contains(&f2));
// KO: different repetition
let f1 = Type::primitive_type_builder("f", PhysicalType::INT32)
.with_repetition(Repetition::REQUIRED)
.build()
.unwrap();
let f2 = Type::primitive_type_builder("f", PhysicalType::INT32)
.with_repetition(Repetition::OPTIONAL)
.build()
.unwrap();
assert!(!f1.check_contains(&f2));
} | rust_cleaned_test_functions.jsonl/16688 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 926
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
63598,
84087,
84087,
368,
341,
286,
442,
10402,
198,
286,
1077,
282,
16,
284,
3990,
486,
73448,
1819,
28532,
445,
69,
497,
27379,
929,
486,
3221,
18,
17,
340,
310,
659,
5834,
741,
310,
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_parse_one_log() -> Result<(), MetricForwarderError> {
let input = [
"MONITORING",
"cool_service",
"2017-04-26T10:41:09.023Z",
"some_\tstr:12345.6|c|#some_key=some_value,some_key_2=some_value_2\n",
];
let expected = Metric::Counter(Counter {
value: 12345.6,
sample_rate: None,
});
let parsed = expect_metric(&input, expected)?;
assert_eq!(parsed.msg.name, "some_\tstr");
assert_eq!(parsed.service_name, "cool_service");
Ok(())
} | rust_cleaned_test_functions.jsonl/132008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
11667,
5224,
368,
1464,
5714,
68843,
52458,
25925,
261,
1454,
29,
341,
286,
1077,
1946,
284,
2278,
310,
330,
21344,
44556,
1718,
756,
310,
330,
42196,
12267,
756,
310,
330,
17,
15,
16,
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... | 2 |
#[test]
fn test_leader_commit_entry() {
setup_for_test();
let s = new_storage();
let mut r = new_test_raft(1, vec![1, 2, 3], 10, 1, s.clone());
r.become_candidate();
r.become_leader();
commit_noop_entry(&mut r, &s);
let li = r.raft_log.last_index();
r.step(new_message(1, 1, MessageType::MsgPropose, 1))
.expect("");
for m in r.read_messages() {
r.step(accept_and_reply(&m)).expect("");
}
assert_eq!(r.raft_log.committed, li + 1);
let wents = vec![new_entry(1, li + 1, SOME_DATA)];
assert_eq!(r.raft_log.next_entries(), Some(wents));
let mut msgs = r.read_messages();
msgs.sort_by_key(|m| format!("{:?}", m));
for (i, m) in msgs.drain(..).enumerate() {
assert_eq!(i as u64 + 2, m.get_to());
assert_eq!(m.get_msg_type(), MessageType::MsgAppend);
assert_eq!(m.get_commit(), li + 1);
}
} | rust_cleaned_test_functions.jsonl/54474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79991,
36346,
9078,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
274,
284,
501,
23310,
543,
262,
1077,
5206,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
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_from_shear() {
let shear_x_with_y = 5;
let shear_y_with_x = 7;
let matrix = Matrix2x2::from_shear(shear_x_with_y, shear_y_with_x);
let expected = Vector2::new(1 + shear_x_with_y, 1 + shear_y_with_x);
let result = matrix * Vector2::new(1, 1);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/128991 | {
"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,
5673,
643,
86060,
368,
341,
286,
1077,
64244,
3212,
6615,
4178,
284,
220,
20,
280,
286,
1077,
64244,
4178,
6615,
3212,
284,
220,
22,
280,
286,
1077,
6172,
284,
11631,
17,
87,
17,
486,
1499,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde_flatten() {
#[derive(Deserialize, Serialize, Apiv2Schema)]
struct PagedQuery {
/// First image number to return
offset: Option<i32>,
/// Return number of images
size: Option<i32>,
};
#[derive(Deserialize, Serialize, Apiv2Schema)]
struct Paging {
/// Starting image number
offset: i32,
/// Total images found
total: i32,
/// Page size
size: i32,
};
#[derive(Serialize, Apiv2Schema)]
struct Image {
data: String,
id: Uuid,
time: chrono_dev::DateTime<chrono_dev::Utc>,
}
/// Images response with paging information embedded
#[derive(Serialize, Apiv2Schema)]
struct Images {
data: Vec<Image>,
#[serde(flatten)]
paging: Paging,
}
/// Query images from library by name
#[derive(Deserialize, Apiv2Schema)]
struct ImagesQuery {
#[serde(flatten)]
paging: PagedQuery,
name: Option<String>,
}
#[api_v2_operation]
async fn some_images(_filter: web::Query<ImagesQuery>) -> Result<web::Json<Images>, ()> {
#[allow(unreachable_code)]
if _filter.paging.offset.is_some() && _filter.name.is_some() {
unimplemented!()
}
unimplemented!()
}
run_and_check_app(
|| {
App::new()
.wrap_api()
.with_json_spec_at("/api/spec")
.service(web::resource("/images").route(web::get().to(some_images)))
.build()
},
|addr| {
let resp = CLIENT
.get(&format!("http://{}/api/spec", addr))
.send()
.expect("request failed?");
check_json(
resp,
json!({
"definitions": {
"Images": {
"properties": {
"data": {
"items": {
"properties": {
"data": {
"type": "string"
},
"id": {
"format": "uuid",
"type": "string"
},
"time": {
"format": "date-time",
"type": "string"
}
},
"required": [
"data",
"id",
"time"
],
"type":"object"
},
"type": "array"
},
"offset": {
"description": "Starting image number",
"format": "int32",
"type": "integer"
},
"size": {
"description": "Page size",
"format": "int32",
"type": "integer"
},
"total": {
"description": "Total images found",
"format": "int32",
"type": "integer"
}
},
"required": [
"data",
"paging"
],
"type":"object"
}
},
"info": {
"title": "",
"version": ""
},
"paths": {
"/images": {
"get": {
"parameters": [
{
"in": "query",
"name": "name",
"type": "string"
},
{
"description": "First image number to return",
"format": "int32",
"in": "query",
"name": "offset",
"type": "integer"
},
{
"description": "Return number of images",
"format": "int32",
"in": "query",
"name": "size",
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Images"
}
}
}
}
}
},
"swagger": "2.0"
}),
);
},
);
} | rust_cleaned_test_functions.jsonl/128120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4008
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
5081,
14456,
368,
341,
262,
11506,
27098,
7,
64465,
11,
39900,
11,
5232,
344,
17,
8632,
5563,
262,
2036,
393,
3279,
2859,
341,
286,
1048,
5512,
2168,
1372,
311,
470,
198,
286,
4347,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_insert_hello_world() {
let mut cl = Cmdline::new(100);
assert_eq!(cl.as_str(), "");
assert!(cl.insert("hello", "world").is_ok());
assert_eq!(cl.as_str(), "hello=world");
let s = CString::new(cl).expect("failed to create CString from Cmdline");
assert_eq!(s, CString::new("hello=world").unwrap());
} | rust_cleaned_test_functions.jsonl/29212 | {
"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,
17678,
96724,
31792,
368,
341,
286,
1077,
5206,
1185,
284,
40210,
1056,
486,
931,
7,
16,
15,
15,
317,
286,
2060,
10714,
10297,
564,
5357,
2895,
1507,
14498,
286,
2060,
10297,
564,
7030,
445,
149... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chunks_last() {
let v: &[i32] = &[0, 1, 2, 3, 4, 5];
let c = v.chunks(2);
assert_eq!(c.last().unwrap()[1], 5);
let v2: &[i32] = &[0, 1, 2, 3, 4];
let c2 = v2.chunks(2);
assert_eq!(c2.last().unwrap()[0], 4);
} | rust_cleaned_test_functions.jsonl/4132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65470,
12195,
368,
341,
262,
1077,
348,
25,
44590,
72,
18,
17,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
272,
284,
348,
5329,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_union_has_impl_action() {
check_actions(
r#"union foo$0() {}"#,
expect![[r#"
[
Implementation(
FilePosition {
file_id: FileId(
0,
),
offset: 6,
},
),
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/66665 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
51621,
21778,
21007,
7931,
368,
341,
286,
1779,
25368,
1006,
310,
435,
55543,
16192,
15229,
3,
15,
368,
4687,
57676,
345,
310,
1720,
0,
15505,
81,
2,
698,
394,
2278,
503,
30813,
1006,
664... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_macro() {
let resp_object = array!["SET", "x"];
let bytes = obj_to_bytes(resp_object);
assert_eq!(bytes, b"*2\r\n$3\r\nSET\r\n$1\r\nx\r\n".as_ref());
let resp_object = array!["RPUSH", "wyz"].extend(vec!["a", "b"]);
let bytes = obj_to_bytes(resp_object);
assert_eq!(
bytes,
b"*4\r\n$5\r\nRPUSH\r\n$3\r\nwyz\r\n$1\r\na\r\n$1\r\nb\r\n".as_ref(),
);
let vals = vec!["a", "b"];
let resp_object = array!["RPUSH", "xyz"].extend(&vals);
let bytes = obj_to_bytes(resp_object);
assert_eq!(
bytes,
&b"*4\r\n$5\r\nRPUSH\r\n$3\r\nxyz\r\n$1\r\na\r\n$1\r\nb\r\n"[..],
);
} | rust_cleaned_test_functions.jsonl/78671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
58810,
368,
341,
286,
1077,
9039,
5314,
284,
1334,
0,
1183,
5884,
497,
330,
87,
6332,
286,
1077,
5820,
284,
2839,
2346,
12524,
20267,
5314,
317,
286,
2060,
10714,
10297,
9651,
11,
293,
615... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_boolean() {
assert_eq!(parse_boolean(&[0][..]), Ok((EMPTY, false)));
assert_eq!(parse_boolean(&[1][..]), Ok((EMPTY, true)));
} | rust_cleaned_test_functions.jsonl/25448 | {
"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,
21039,
46642,
368,
341,
286,
2060,
10714,
10297,
6400,
46642,
2099,
58,
15,
1457,
496,
9719,
7622,
1188,
32858,
11,
895,
4945,
286,
2060,
10714,
10297,
6400,
46642,
2099,
58,
16,
1457,
496,
9719,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_take_nonpod_by_ptr_simple() {
let cxx = indoc! {"
uint32_t take_bob(const Bob* a) {
return a->a;
}
std::unique_ptr<Bob> make_bob(uint32_t a) {
auto b = std::make_unique<Bob>();
b->a = a;
return b;
}
"};
let hdr = indoc! {"
#include <cstdint>
#include <memory>
struct Bob {
uint32_t a;
};
std::unique_ptr<Bob> make_bob(uint32_t a);
uint32_t take_bob(const Bob* a);
"};
let rs = quote! {
let a = ffi::make_bob(12);
let a_ptr = a.into_raw();
assert_eq!(unsafe { ffi::take_bob(a_ptr) }, 12);
unsafe { cxx::UniquePtr::from_raw(a_ptr) }; // so we drop
};
run_test(cxx, hdr, rs, &["take_bob", "Bob", "make_bob"], &[]);
} | rust_cleaned_test_functions.jsonl/9742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
21637,
39073,
3710,
4348,
30015,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
2622,
18,
17,
528,
1896,
880,
674,
2741,
14261,
9,
264,
8,
341,
310,
470,
264,
405,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_col_prune_derived_dup_cols() {
assert_j_plan(
"select (select sum(c0) from t3 where t3.c1 = t2.c1 and t3.c2 = t2.c2), c1 from t2",
|sql, mut plan| {
col_prune(&mut plan.qry_set, plan.root).unwrap();
let subq = get_lvl_queries(&plan, 1);
assert_eq!(2, subq[0].out_cols().len());
print_plan(sql, &plan)
},
)
} | rust_cleaned_test_functions.jsonl/27148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10211,
5294,
2886,
35345,
2221,
51932,
25347,
368,
341,
286,
2060,
5374,
26564,
1006,
310,
330,
1742,
320,
1742,
2629,
1337,
15,
8,
504,
259,
18,
1380,
259,
18,
520,
16,
284,
259,
17,
520,
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_segments_of_raw_buffers() {
let buf = vec![255u8; 1];
let input = vec![buf.clone(), buf.clone(), buf.clone()];
assert_write_check_read(input, 8);
} | rust_cleaned_test_functions.jsonl/118850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55735,
3575,
16067,
54591,
368,
341,
262,
1077,
6607,
284,
7486,
20703,
17,
20,
20,
84,
23,
26,
220,
16,
4821,
262,
1077,
1946,
284,
7486,
20703,
5909,
15997,
1507,
6607,
15997,
1507,
6607,
1599... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cow_is_well_encoded() {
assert_eq!(
Extension::NoBody.to_cow(),
Extension::NoBody.to_encoded_string()
);
assert_eq!(
Extension::Hierarchy.to_string(),
Extension::Hierarchy.to_encoded_string()
);
assert_eq!(
Extension::FlatUsage(1.to_string().into()).to_string(),
Extension::FlatUsage(1.to_string().into()).to_encoded_string()
);
assert_eq!(
Extension::AppKeysList(1.to_string().into()).to_string(),
Extension::AppKeysList(1.to_string().into()).to_encoded_string()
);
let ext = Extension::Other("some;[]key&%1".into(), "a_^&[]%:;@value".into());
assert_eq!(ext.to_string(), ext.to_encoded_string());
} | rust_cleaned_test_functions.jsonl/84394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 407
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
666,
363,
6892,
1670,
613,
73069,
368,
341,
286,
2060,
10714,
33673,
310,
26473,
486,
2753,
5444,
2389,
666,
363,
3148,
310,
26473,
486,
2753,
5444,
2389,
73069,
3904,
741,
286,
1439,
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_ocaml_hashes() {
let mut json_file = open_hashes_json("ocaml_hash.json");
let test_cases: Vec<OCamlHashTest> = serde_json::from_reader(&mut json_file).unwrap();
for test_case in test_cases {
let computed_hash = ocaml_hash_string(test_case.seed, test_case.s.as_bytes());
assert_eq!(
test_case.ocaml_hash, computed_hash,
"Expected hash of v={} with seed={} to be {}, but got {}",
test_case.s, test_case.seed, test_case.ocaml_hash, computed_hash
);
}
} | rust_cleaned_test_functions.jsonl/24605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49648,
9467,
91616,
368,
341,
286,
1077,
5206,
2951,
2458,
284,
1787,
91616,
9455,
445,
509,
9467,
8950,
4323,
3071,
286,
1077,
1273,
41427,
25,
11312,
27,
7612,
9467,
6370,
2271,
29,
284,
61570,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_redeem_with_shares_and_exit_price() {
let mut context = get_context(accounts(0));
testing_env!(context.build());
let mut contract = Shares::create(
NFT_CONTRACT_ADDRESS.into(),
NFT_TOKEN_ID.into(),
accounts(0),
TOTAL_SUPPLY.into(),
DECIMALS,
SHARE_PRICE.into()
);
// Paying for account registration for account 1
testing_env!(context
.storage_usage(env::storage_usage())
.attached_deposit(contract.storage_balance_bounds().min.into())
.predecessor_account_id(accounts(1))
.build());
contract.storage_deposit(None, None);
let transferred_shares = 100;
testing_env!(context
.storage_usage(env::storage_usage())
.attached_deposit(1)
.signer_account_id(accounts(0))
.predecessor_account_id(accounts(0))
.build());
contract.ft_transfer(accounts(1), transferred_shares.into(), None);
let sender_balance = contract.ft_balance_of(accounts(0));
let receiver_balance = contract.ft_balance_of(accounts(1));
assert_eq!(sender_balance.0, TOTAL_SUPPLY - transferred_shares, "Error sender balance: {}", sender_balance.0);
assert_eq!(receiver_balance.0, transferred_shares, "Error receiver balance: {}", receiver_balance.0);
let redeem_amount = contract.redeem_amount_of(accounts(1));
let exit_price = contract.exit_price();
assert!(redeem_amount.0 + transferred_shares*SHARE_PRICE == exit_price.0);
// Payment will be through shares and NEAR
testing_env!(context
.attached_deposit(redeem_amount.0)
.signer_account_id(accounts(1))
.predecessor_account_id(accounts(1))
.build());
contract.redeem();
// Tests
assert!(contract.ft_metadata().released);
assert!(contract.ft_total_supply().0 == TOTAL_SUPPLY - transferred_shares, "Total supply {}", contract.ft_total_supply().0);
let shareholder_balance = contract.ft_balance_of(accounts(0));
let redeemer_balance = contract.ft_balance_of(accounts(1));
assert!(redeemer_balance.0 == 0, "Redeemer balance: {}, shareholder balance: {}", redeemer_balance.0, shareholder_balance.0);
} | rust_cleaned_test_functions.jsonl/21364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1078
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
450,
336,
6615,
3712,
5403,
8378,
16880,
9040,
368,
341,
286,
1077,
5206,
2266,
284,
633,
8467,
91868,
7,
15,
1106,
286,
7497,
15879,
10297,
2147,
13239,
5231,
286,
1077,
5206,
5116,
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_lazy_wildcard() {
let df = load_df();
let new = df.clone().lazy().select(&[col("*")]).collect().unwrap();
assert_eq!(new.shape(), (5, 3));
let new = df
.lazy()
.groupby(vec![col("b")])
.agg(vec![col("*").sum(), col("*").first()])
.collect()
.unwrap();
assert_eq!(new.shape(), (3, 6));
} | rust_cleaned_test_functions.jsonl/14672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49646,
1670,
695,
4951,
368,
341,
286,
1077,
6764,
284,
2795,
10894,
543,
286,
1077,
501,
284,
6764,
15997,
1005,
49013,
1005,
1742,
2099,
58,
2074,
29592,
899,
10697,
17384,
1005,
15454,
543,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_port() {
assert_eq!(Url::parse("http://example.com/wow").unwrap().port(), 80u16);
assert_eq!(Url::parse("https://example.com/wow").unwrap().port(), 443u16);
} | rust_cleaned_test_functions.jsonl/80263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
8716,
368,
341,
286,
2060,
10714,
10297,
2864,
486,
6400,
445,
1254,
1110,
8687,
905,
6324,
363,
1827,
15454,
1005,
403,
1507,
220,
23,
15,
84,
16,
21,
317,
286,
2060,
10714,
10297,
2864,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inline_let_bind_cast_expr() {
check_assist(
inline_local_variable,
"
fn bar(a: usize): usize { a }
fn foo() {
let a<|> = bar(1) as u64;
a + 1;
if a > 10 {
}
while a > 10 {
}
let b = a * 10;
bar(a);
}",
"
fn bar(a: usize): usize { a }
fn foo() {
<|>(bar(1) as u64) + 1;
if (bar(1) as u64) > 10 {
}
while (bar(1) as u64) > 10 {
}
let b = (bar(1) as u64) * 10;
bar(bar(1) as u64);
}",
);
} | rust_cleaned_test_functions.jsonl/60314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41871,
62,
1149,
27461,
5303,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
6228,
8822,
3619,
2877,
25,
22301,
1648,
22301,
314,
264,
456,
8822,
15229,
368,
341,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fi_fo_buf() {
let mut a = [0u8; 4];
let b = [1u8, 2, 3, 4];
ocall::copy(&mut a[..], &b[..]).unwrap();
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/31499 | {
"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,
761,
72,
761,
78,
10363,
368,
341,
262,
1077,
5206,
264,
284,
508,
15,
84,
23,
26,
220,
19,
935,
262,
1077,
293,
284,
508,
16,
84,
23,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
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_store_overhead() {
solana_logger::setup();
let accounts = AccountsDb::new_single();
let account = AccountSharedData::default();
let pubkey = solana_sdk::pubkey::new_rand();
accounts.store_uncached(0, &[(&pubkey, &account)]);
let slot_stores = accounts.storage.get_slot_stores(0).unwrap();
let mut total_len = 0;
for (_id, store) in slot_stores.read().unwrap().iter() {
total_len += store.accounts.len();
}
info!("total: {}", total_len);
assert!(total_len < STORE_META_OVERHEAD);
} | rust_cleaned_test_functions.jsonl/1406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14809,
15431,
1983,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
9618,
284,
40655,
7994,
486,
931,
19487,
543,
286,
1077,
2692,
284,
8615,
16997,
1043,
486,
2258,
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... | 2 |
#[test]
fn test_exp() {
assert_eq!(1.0, 0.0f32.exp());
assert_approx_eq!(2.718282, 1.0f32.exp());
assert_approx_eq!(148.413162, 5.0f32.exp());
let inf: f32 = f32::INFINITY;
let neg_inf: f32 = f32::NEG_INFINITY;
let nan: f32 = f32::NAN;
assert_eq!(inf, inf.exp());
assert_eq!(0.0, neg_inf.exp());
assert!(nan.exp().is_nan());
} | rust_cleaned_test_functions.jsonl/8119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14214,
368,
341,
286,
2060,
10714,
10297,
16,
13,
15,
11,
220,
15,
13,
15,
69,
18,
17,
13754,
1423,
286,
2060,
90425,
10714,
10297,
17,
13,
22,
16,
23,
17,
23,
17,
11,
220,
16,
13,
15,
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_parse_adstxt() {
assert_eq!(
parse_adstxt(
"# Ads.txt file for example.com:
greenadexchange.com, 12345, DIRECT, d75815a79
blueadexchange.com, XF436, DIRECT
contact=adops@example.com
contact=http://example.com/contact-us
subdomain=divisionone.example.com"
)
.unwrap(),
AdsTxt {
records: vec![
Record {
domain: "greenadexchange.com",
account_id: "12345",
relation: Relation::Direct,
authority_id: Some("d75815a79"),
},
Record {
domain: "blueadexchange.com",
account_id: "XF436",
relation: Relation::Direct,
authority_id: None,
},
],
variables: {
let mut map = HashMap::new();
map.insert(
"contact",
vec!["adops@example.com", "http://example.com/contact-us"],
);
map.insert("subdomain", vec!["divisionone.example.com"]);
map
}
},
)
} | rust_cleaned_test_functions.jsonl/95248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 712
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
10027,
267,
2252,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
10027,
267,
2252,
1006,
310,
5869,
42183,
3909,
1034,
369,
3110,
905,
510,
13250,
329,
39568,
905,
11,
220,
16,
17,
18,
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_is_pod_created() {
assert!(!is_pod_created(None));
let mut pod = Pod { ..Pod::default() };
assert!(!is_pod_created(Some(&pod)));
pod.status = Some(PodStatus {
phase: Some("".to_string()),
..PodStatus::default()
});
assert!(!is_pod_created(Some(&pod)));
pod.status = Some(PodStatus {
phase: Some("Running".to_string()),
..PodStatus::default()
});
assert!(is_pod_created(Some(&pod)));
} | rust_cleaned_test_functions.jsonl/59341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
85337,
27288,
368,
341,
286,
2060,
0,
3471,
285,
85337,
27288,
26717,
3237,
286,
1077,
5206,
7509,
284,
16821,
314,
5241,
23527,
486,
2258,
368,
2605,
286,
2060,
0,
3471,
285,
85337,
27288,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expression_chaining() {
let mut context = HashMapContext::new();
assert_eq!(
eval_int_with_context_mut("a = 5; a = a + 2; a", &mut context),
Ok(7)
);
} | rust_cleaned_test_functions.jsonl/105354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28068,
4138,
2056,
368,
341,
262,
1077,
5206,
2266,
284,
10528,
1972,
486,
931,
543,
262,
2060,
10714,
33673,
286,
5603,
4042,
6615,
8467,
29523,
445,
64,
284,
220,
20,
26,
264,
284,
264,
488,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_world_symbols_with_no_container() {
let code = r#"
enum FooInner { }
"#;
let mut symbols = get_symbols_matching(code, "FooInner");
let s = symbols.pop().unwrap();
assert_eq!(s.name(), "FooInner");
assert!(s.container_name().is_none());
} | rust_cleaned_test_functions.jsonl/19269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31792,
55752,
6615,
6536,
15847,
368,
341,
262,
1077,
2038,
284,
435,
2,
698,
262,
7618,
33428,
31597,
314,
456,
262,
5869,
401,
262,
1077,
5206,
17738,
284,
633,
55752,
70763,
15842,
11,
330,
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_union() {
let p = Rect::new(Point2D::new(0, 0), Size2D::new(50, 40));
let q = Rect::new(Point2D::new(20,20), Size2D::new(5, 5));
let r = Rect::new(Point2D::new(-15, -30), Size2D::new(200, 15));
let s = Rect::new(Point2D::new(20, -15), Size2D::new(250, 200));
let pq = p.union(&q);
assert!(pq.origin == Point2D::new(0, 0));
assert!(pq.size == Size2D::new(50, 40));
let pr = p.union(&r);
assert!(pr.origin == Point2D::new(-15, -30));
assert!(pr.size == Size2D::new(200, 70));
let ps = p.union(&s);
assert!(ps.origin == Point2D::new(0, -15));
assert!(ps.size == Size2D::new(270, 200));
} | rust_cleaned_test_functions.jsonl/24156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51621,
368,
341,
286,
1077,
281,
284,
11920,
486,
931,
32737,
17,
35,
486,
931,
7,
15,
11,
220,
15,
701,
8478,
17,
35,
486,
931,
7,
20,
15,
11,
220,
19,
15,
1106,
286,
1077,
2804,
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... | 1 |
#[test]
fn test_reductions_steps() {
let s = "[[[[[4,3],4],4],[7,[[8,4],9]]],[1,1]]";
let mut num = Num::from_input(s);
num.explode(0);
assert_eq!(num._format(), "[[[[0,7],4],[7,[[8,4],9]]],[1,1]]");
num.explode(4);
assert_eq!(num._format(), "[[[[0,7],4],[15,[0,13]]],[1,1]]");
num.split(3);
assert_eq!(num._format(), "[[[[0,7],4],[[7,8],[0,13]]],[1,1]]");
num.split(6);
assert_eq!(num._format(), "[[[[0,7],4],[[7,8],[0,[6,7]]]],[1,1]]");
num.explode(6);
assert_eq!(num._format(), "[[[[0,7],4],[[7,8],[6,0]]],[8,1]]");
} | rust_cleaned_test_functions.jsonl/122921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
1054,
5136,
22731,
368,
341,
286,
1077,
274,
284,
10545,
15505,
15505,
19,
11,
18,
1125,
19,
1125,
19,
14955,
22,
11,
15505,
23,
11,
19,
1125,
24,
5053,
14955,
16,
11,
16,
5053,
876,
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_ctx_alias_broken_regex() -> io::Result<()> {
base_test_ctx_alias(
"input",
toml::toml! {
[kubernetes]
disabled = false
[kubernetes.context_aliases]
"input[.*" = "this does not match"
},
"☸ input",
)
} | rust_cleaned_test_functions.jsonl/41176 | {
"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,
15147,
35947,
880,
81709,
41832,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
2331,
4452,
15147,
35947,
1006,
310,
330,
1355,
756,
310,
311,
1014,
486,
37401,
75,
0,
341,
394,
508,
74,
29827,
92... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_channel_disconnection() {
let system = KompactConfig::default().build().expect("System");
let sender = system.create(CountSender::default);
let counter1 = system.create(Counter::default);
let counter2 = system.create(Counter::default);
let channel1: Box<(dyn Channel + Send + 'static)> =
biconnect_components::<CounterPort, _, _>(&sender, &counter1)
.expect("connection")
.boxed();
let channel2 =
biconnect_components::<CounterPort, _, _>(&sender, &counter2).expect("connection");
let start_all = || {
let sender_start_f = system.start_notify(&sender);
let counter1_start_f = system.start_notify(&counter1);
let counter2_start_f = system.start_notify(&counter2);
sender_start_f
.wait_timeout(TIMEOUT)
.expect("sender started");
counter1_start_f
.wait_timeout(TIMEOUT)
.expect("counter1 started");
counter2_start_f
.wait_timeout(TIMEOUT)
.expect("counter2 started");
};
start_all();
sender.actor_ref().tell(SendCount);
thread::sleep(TIMEOUT);
let stop_all = || {
let sender_stop_f = system.stop_notify(&sender);
let counter1_stop_f = system.stop_notify(&counter1);
let counter2_stop_f = system.stop_notify(&counter2);
sender_stop_f.wait_timeout(TIMEOUT).expect("sender stopped");
counter1_stop_f
.wait_timeout(TIMEOUT)
.expect("counter1 stopped");
counter2_stop_f
.wait_timeout(TIMEOUT)
.expect("counter2 stopped");
};
stop_all();
let check_counts = |sender_expected, counter1_expected, counter2_expected| {
let sender_count = sender.on_definition(|cd| cd.counted);
assert_eq!(sender_expected, sender_count);
let counter1_count = counter1.on_definition(|cd| cd.count);
assert_eq!(counter1_expected, counter1_count);
let counter2_count = counter2.on_definition(|cd| cd.count);
assert_eq!(counter2_expected, counter2_count);
};
check_counts(2, 1, 1);
channel2.disconnect().expect("disconnect");
start_all();
sender.actor_ref().tell(SendCount);
thread::sleep(TIMEOUT);
stop_all();
check_counts(3, 2, 1);
channel1.disconnect().expect("disconnect");
start_all();
sender.actor_ref().tell(SendCount);
thread::sleep(TIMEOUT);
stop_all();
check_counts(3, 2, 1);
let sender_port: ProvidedRef<CounterPort> = sender.provided_ref();
let counter1_port: RequiredRef<CounterPort> = counter1.required_ref();
let channel1: Box<(dyn Channel + Send + 'static)> =
sender.connect_to_required(counter1_port).boxed();
let channel2 = counter2.connect_to_provided(sender_port);
start_all();
sender.actor_ref().tell(SendCount);
thread::sleep(TIMEOUT);
stop_all();
check_counts(3, 3, 1);
let counter2_port: RequiredRef<CounterPort> = counter2.required_ref();
let channel3 = sender.connect_to_required(counter2_port);
start_all();
sender.actor_ref().tell(SendCount);
thread::sleep(TIMEOUT);
stop_all();
check_counts(4, 4, 2);
channel1.disconnect().expect("disconnected");
channel2.disconnect().expect("disconnected");
channel3.disconnect().expect("disconnected");
start_all();
sender.actor_ref().tell(SendCount);
thread::sleep(TIMEOUT);
stop_all();
check_counts(4, 4, 2);
system.shutdown().expect("shutdown");
} | rust_cleaned_test_functions.jsonl/107766 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1836
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14571,
9932,
7742,
368,
341,
286,
1077,
1849,
284,
730,
14435,
531,
2648,
486,
2258,
1005,
5834,
1005,
17119,
445,
2320,
797,
286,
1077,
4646,
284,
1849,
2520,
7,
2507,
20381,
486,
2258,
626,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pairs() {
let mut pairs = Pairs::with_capacity(1).unwrap();
pairs.push(10, 20).unwrap();
pairs.push(20, 10).unwrap();
pairs.push(10, 10).unwrap();
pairs.compact();
for i in 0..pairs.len() {
let kv = pairs.get(i).unwrap();
println!("kv[{}]: key={}, len={}", i, kv.key, kv.val);
}
} | rust_cleaned_test_functions.jsonl/60106 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36430,
368,
341,
286,
1077,
5206,
13530,
284,
393,
4720,
486,
4197,
35603,
7,
16,
568,
15454,
1428,
286,
13530,
2552,
7,
16,
15,
11,
220,
17,
15,
568,
15454,
543,
286,
13530,
2552,
7,
17,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_outer_doc_comment_of_items() {
let file = SourceFile::parse(
r#"
/// doc
// non-doc
mod foo {}
"#,
)
.ok()
.unwrap();
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
assert_eq!(" doc", module.doc_comments().doc_comment_text().unwrap());
} | rust_cleaned_test_functions.jsonl/60276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67258,
18869,
17638,
3575,
12134,
368,
341,
262,
1077,
1034,
284,
8748,
1703,
486,
6400,
1006,
286,
435,
2,
698,
286,
1048,
4629,
198,
286,
442,
2477,
11527,
198,
286,
1463,
15229,
5613,
286,
58... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_init_with_file() {
let wallet_name = "test_init_with_file";
::utils::devsetup::tests::setup_ledger_env(wallet_name);
wallet::close_wallet().unwrap();
pool::close().unwrap();
let config_path = "/tmp/test_init.json";
let content = create_config_util(&wallet_name, settings::TEST_WALLET_KEY);
settings::write_config_to_file(&content, config_path).unwrap();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init(cb.command_handle,
CString::new(config_path).unwrap().into_raw(),
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(Some(Duration::from_secs(10))).unwrap();
// Assert pool was initialized
assert_ne!(get_pool_handle().unwrap(), 0);
::utils::devsetup::tests::cleanup_dev_env(wallet_name);
} | rust_cleaned_test_functions.jsonl/19795 | {
"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,
6137,
6615,
2458,
368,
341,
286,
1077,
15085,
1269,
284,
330,
1944,
6137,
6615,
2458,
876,
286,
3504,
6031,
486,
3583,
15188,
486,
23841,
486,
15188,
38367,
1389,
15879,
95586,
1269,
317,
286,
150... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lint_redundant() {
let m = module(
r#"
def test(): # 1
foo
return # bad: 3
def test2(): # 4
return
foo
def test3(): # 7
if x:
return # bad: 9
else:
y + 1
def test4(): # 12
def test5():
for x in xs:
test
if x:
return
else:
continue # bad: 19
test5()
def test6():
if x:
return
y + 1
def test7():
for x in xs:
if x:
continue
return
"#,
);
let mut res = Vec::new();
redundant(&m.codemap, &m.statement, &mut res);
assert_eq!(
res.map(|x| x.location.resolve_span().begin_line),
&[3, 9, 19]
);
} | rust_cleaned_test_functions.jsonl/6153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
396,
1288,
1054,
303,
517,
368,
341,
286,
1077,
296,
284,
4688,
1006,
310,
435,
2,
698,
750,
1273,
4555,
671,
220,
16,
198,
262,
15229,
198,
262,
470,
671,
3873,
25,
220,
18,
198,
750,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_reader_rows_nonnullable_typed() {
type RowTyped = (
i64,
List<i32>,
List<List<i32>>,
HashMap<String, i32>,
List<HashMap<String, i32>>,
(
i32,
List<i32>,
(List<List<(i32, String)>>,),
HashMap<String, ((List<f64>,),)>,
),
);
let rows = test_file_reader_rows::<RowTyped>("nonnullable.impala.parquet", None).unwrap();
let expected_rows: Vec<RowTyped> = vec![(
8,
list![-1],
list![list![-1, -2], list![]],
map![("k1".to_string(), -1)],
list![map![], map![("k1".to_string(), 1i32)], map![], map![]],
(
-1,
list![-1],
(list![list![(-1, "nonnullable".to_string())]],),
map![],
),
)];
assert_eq!(rows, expected_rows);
} | rust_cleaned_test_functions.jsonl/92460 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 393
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
22306,
10949,
21637,
12902,
528,
32501,
368,
341,
197,
13158,
10801,
44466,
284,
2399,
298,
8230,
21,
19,
345,
298,
10675,
21897,
18,
17,
12520,
298,
10675,
15161,
21897,
18,
17,
61340,
298,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_df_compatible_type() {
let (_, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg("-aT").run();
assert!(result.success);
} | rust_cleaned_test_functions.jsonl/3987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10894,
2965,
37079,
1819,
368,
341,
262,
1077,
39464,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1102,
284,
575,
8710,
21186,
13645,
64,
51,
1827,
6108,
543,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_attribute_refsig8() {
let buf = [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x99, 0x99];
let unit = test_parse_attribute_unit_default();
let form = constants::DW_FORM_ref_sig8;
let value = AttributeValue::DebugTypesRef(DebugTypeSignature(0x0807_0605_0403_0201));
test_parse_attribute(&buf, 8, &unit, form, value);
} | rust_cleaned_test_functions.jsonl/102041 | {
"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,
21039,
16791,
7793,
21339,
23,
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,
15,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_signed_msg() {
// Public key
let secret_key =
hex::decode("2009da7287c158b126123c113d1c85241b6e3294dd75c643588630a8bc0f934c")
.unwrap();
let public_key = Bn256.derive_public_key(&secret_key).unwrap();
// Signature
let signature =
hex::decode("020f047a153e94b5f109e4013d1bd078112817cf0d58cdf6ba8891f9849852ba5b")
.unwrap();
// Message signed
let msg = hex::decode("73616d706c65").unwrap();
// Verify signature
assert!(
Bn256.verify(&signature, &msg, &public_key).is_ok(),
"Verification failed"
);
} | rust_cleaned_test_functions.jsonl/65097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
55617,
6483,
368,
341,
286,
442,
3066,
1376,
198,
286,
1077,
6234,
3097,
4035,
310,
12371,
486,
18196,
445,
17,
15,
15,
24,
3235,
22,
17,
23,
22,
66,
16,
20,
23,
65,
16,
17,
21,
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_add_object() {
let root = json!({
"hello": "123",
"world": 123,
});
let value_to_add = json!("added");
let path = Path::new("/new");
let new = add(root, value_to_add, path).unwrap();
assert_eq!(new.get("new").unwrap(), &json!("added"));
let new_again = add(new, json!(234), Path::new("/hello")).unwrap();
assert_eq!(new_again.get("hello").unwrap(), &json!(234));
} | rust_cleaned_test_functions.jsonl/83909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5314,
368,
341,
286,
1077,
3704,
284,
2951,
0,
2262,
310,
330,
14990,
788,
330,
16,
17,
18,
756,
310,
330,
14615,
788,
220,
16,
17,
18,
345,
286,
1625,
286,
1077,
897,
2346,
2891,
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_test_case_7() {
let key = Vec::from_hex("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").unwrap();
let data =
"Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data".as_bytes();
let expected = "6f630fad67cda0ee1fb1f562db3aa53e";
run_test_case(&key[..], data, expected);
} | rust_cleaned_test_functions.jsonl/17344 | {
"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,
4452,
19096,
62,
22,
368,
341,
286,
1077,
1376,
284,
11312,
486,
1499,
32655,
445,
69440,
69440,
69440,
69440,
69440,
69440,
69440,
69440,
69440,
69440,
69440,
69440,
69440,
69440,
69440,
69440,
69440... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_colinear_3() {
let mut builder = Path::builder();
// The path goes through many points along a line.
builder.begin(point(0.0, 1.0));
builder.line_to(point(0.0, 3.0));
builder.line_to(point(0.0, 5.0));
builder.line_to(point(0.0, 4.0));
builder.line_to(point(0.0, 2.0));
builder.end(true);
let path = builder.build();
test_path(path.as_slice());
} | rust_cleaned_test_functions.jsonl/102420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10211,
88921,
62,
18,
368,
341,
262,
1077,
5206,
7363,
284,
7933,
486,
17850,
543,
262,
442,
576,
1815,
5780,
1526,
1657,
3501,
3156,
264,
1555,
624,
262,
7363,
6848,
20235,
7,
15,
13,
15,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_with_an_apns_topic() {
let builder = PlainNotificationBuilder::new("test");
let payload = builder.build(
"a_test_id",
NotificationOptions {
apns_topic: Some("a_topic"),
..Default::default()
},
);
let client = Client::new(AlpnConnector::new(), None, Endpoint::Production);
let request = client.build_request(payload);
let apns_topic = request.headers().get("apns-topic").unwrap();
assert_eq!("a_topic", apns_topic);
} | rust_cleaned_test_functions.jsonl/109659 | {
"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,
7893,
6615,
12008,
21093,
4412,
31414,
368,
341,
286,
1077,
7363,
284,
43199,
11196,
3297,
486,
931,
445,
1944,
3071,
286,
1077,
7729,
284,
7363,
13239,
1006,
310,
330,
64,
4452,
842,
756,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gen_outputs_for_transfer_of_tokens() {
init!("true");
let payee_amount = 11;
let payee_address = r#"pay:null:payee_address"#.to_string();
let refund_address = r#"pay:null:refund_address"#;
let expected_output = format!(r#"[{{"amount":4,"recipient":"{}"}},{{"amount":11,"recipient":"{}"}}]"#, refund_address, payee_address);
assert_eq!(outputs(4, refund_address, Some(payee_address), Some(payee_amount)).unwrap(), expected_output);
} | rust_cleaned_test_functions.jsonl/10480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
35189,
5478,
35403,
3575,
28838,
368,
341,
286,
2930,
17223,
1866,
3071,
286,
1077,
2291,
2127,
13471,
284,
220,
16,
16,
280,
286,
1077,
2291,
2127,
6744,
284,
435,
55543,
13890,
53098,
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_parse_partial_min() {
let range = LineRange::from(":50").expect("Shouldn't fail on test!");
assert_eq!(usize::min_value(), range.lower);
assert_eq!(50, range.upper);
} | rust_cleaned_test_functions.jsonl/35924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
52068,
7260,
368,
341,
262,
1077,
2088,
284,
7083,
6046,
486,
1499,
18893,
20,
15,
1827,
17119,
445,
14996,
77,
944,
3690,
389,
1273,
11142,
262,
2060,
10714,
10297,
51878,
486,
1065,
3142,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_struct() {
let a: Arc<Array> = Arc::new(PrimitiveArray::from(Buffer::from(vec![1, 2, 3, 4, 5])));
let b: Arc<Array> = Arc::new(PrimitiveArray::from(Buffer::from(vec![
1.1, 2.2, 3.3, 4.4, 5.5,
])));
let s = StructArray::from(vec![a, b]);
assert_eq!(2, s.num_columns());
assert_eq!(0, s.null_count());
} | rust_cleaned_test_functions.jsonl/32614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
368,
341,
286,
1077,
264,
25,
19689,
60190,
29,
284,
19689,
486,
931,
7,
33313,
1857,
486,
1499,
55574,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_table_from_entity_table_ref() {
for builder in [DbBackend::MySql, DbBackend::Postgres, DbBackend::Sqlite] {
let schema = Schema::new(builder);
assert_eq!(
builder.build(&schema.create_table_from_entity(CakeFillingPrice)),
builder.build(&get_stmt().table(CakeFillingPrice.table_ref()).to_owned())
);
}
} | rust_cleaned_test_functions.jsonl/120023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
5237,
5673,
19169,
5237,
7793,
368,
341,
286,
369,
7363,
304,
508,
7994,
29699,
486,
5050,
8269,
11,
11988,
29699,
486,
4133,
17818,
11,
11988,
29699,
486,
8269,
632,
60,
341,
310,
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... | 2 |
#[test]
fn test_ips() -> Result<()> {
test_opt(
DhcpOption::DomainNameServer(vec![
"192.168.0.1".parse::<Ipv4Addr>().unwrap(),
"192.168.1.1".parse::<Ipv4Addr>().unwrap(),
]),
vec![6, 8, 192, 168, 0, 1, 192, 168, 1, 1],
)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/41163 | {
"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,
71074,
368,
1464,
5714,
71698,
341,
286,
1273,
15032,
1006,
310,
43227,
4672,
5341,
486,
13636,
675,
5475,
25592,
90515,
394,
330,
16,
24,
17,
13,
16,
21,
23,
13,
15,
13,
16,
3263,
6400,
27638... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_concat_boolean_primitive_arrays() -> Result<()> {
let arr = concat(&[
&BooleanArray::from(vec![
Some(true),
Some(true),
Some(false),
None,
None,
Some(false),
]),
&BooleanArray::from(vec![None, Some(false), Some(true), Some(false)]),
])?;
let expected_output = Arc::new(BooleanArray::from(vec![
Some(true),
Some(true),
Some(false),
None,
None,
Some(false),
None,
Some(false),
Some(true),
Some(false),
])) as ArrayRef;
assert_eq!(&arr, &expected_output);
Ok(())
} | rust_cleaned_test_functions.jsonl/25090 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57478,
46642,
84087,
68983,
368,
1464,
5714,
71698,
341,
286,
1077,
2890,
284,
33720,
2099,
9640,
310,
609,
6890,
1857,
486,
1499,
25592,
90515,
394,
4329,
3715,
1326,
394,
4329,
3715,
1326,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_block_hash_contract() {
let (mut runner, mut source_account, _) = initialize_transfer();
let test_constructor = test_utils::solidity::ContractConstructor::compile_from_source(
["src", "tests", "res"].iter().collect::<PathBuf>(),
Path::new("target").join("solidity_build"),
"blockhash.sol",
"BlockHash",
);
let nonce = source_account.use_nonce();
let test_contract = runner.deploy_contract(
&source_account.secret_key,
|c| c.deploy_without_args(nonce.into()),
test_constructor,
);
let result = runner
.submit_with_signer(&mut source_account, |nonce| {
test_contract.call_method_without_args("test", nonce)
})
.unwrap();
test_utils::panic_on_fail(result.status);
} | rust_cleaned_test_functions.jsonl/131051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
8950,
51499,
368,
341,
262,
1077,
320,
6984,
22259,
11,
5206,
2530,
13500,
11,
27439,
284,
9468,
35403,
543,
262,
1077,
1273,
66210,
284,
1273,
17309,
486,
31027,
487,
486,
14067,
13288,
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_weighted_choice_weight_overflows() {
let x = ::core::u32::MAX / 2; // x + x + 2 is the overflow
WeightedChoice::new(&mut [Weighted { weight: x, item: 0 },
Weighted { weight: 1, item: 1 },
Weighted { weight: x, item: 2 },
Weighted { weight: 1, item: 3 }]);
} | rust_cleaned_test_functions.jsonl/100785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15876,
291,
31936,
15876,
15431,
38140,
368,
341,
286,
1077,
856,
284,
3504,
2153,
486,
84,
18,
17,
486,
10586,
608,
220,
17,
26,
442,
856,
488,
856,
488,
220,
17,
374,
279,
16484,
198,
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_zero_balance_proof_correctness() {
let source_keypair = ElGamalKeypair::new_rand();
let mut transcript_prover = Transcript::new(b"test");
let mut transcript_verifier = Transcript::new(b"test");
// general case: encryption of 0
let elgamal_ciphertext = source_keypair.public.encrypt(0_u64);
let proof =
ZeroBalanceProof::new(&source_keypair, &elgamal_ciphertext, &mut transcript_prover);
assert!(proof
.verify(
&source_keypair.public,
&elgamal_ciphertext,
&mut transcript_verifier
)
.is_ok());
// general case: encryption of > 0
let elgamal_ciphertext = source_keypair.public.encrypt(1_u64);
let proof =
ZeroBalanceProof::new(&source_keypair, &elgamal_ciphertext, &mut transcript_prover);
assert!(proof
.verify(
&source_keypair.public,
&elgamal_ciphertext,
&mut transcript_verifier
)
.is_err());
} | rust_cleaned_test_functions.jsonl/90010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 552
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
29396,
86757,
31550,
2090,
368,
341,
286,
1077,
2530,
3097,
12670,
284,
3984,
78884,
278,
6608,
1082,
1310,
486,
931,
33864,
1428,
286,
1077,
5206,
35715,
2540,
423,
284,
90303,
486,
931,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timestamp_serialization() {
let time_stamp = Timestamp::new(PrimitiveDateTime::new(
time::date!(2020 - 1 - 01),
time::time!(12:34:54),
));
let json = json!({ "time stamp test": time_stamp });
assert_eq!(json!({"time stamp test":"2020-01-01T12:34:54-00"}), json);
} | rust_cleaned_test_functions.jsonl/47264 | {
"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,
23073,
25602,
2022,
368,
341,
286,
1077,
882,
52978,
284,
32758,
486,
931,
7,
33313,
7689,
486,
931,
1006,
310,
882,
486,
1028,
10297,
17,
15,
17,
15,
481,
220,
16,
481,
220,
15,
16,
1326,
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_return() {
let prog = r#"
fn greater_than_five(a: int) -> bool {
if a > 5 {
return true;
}
false
}
greater_than_five(6)
"#;
let ast = program(prog).unwrap();
let mut state = State::default();
SymbolDefineVisitor::visit(&ast, &mut state).unwrap();
TypeComputationVisitor::visit(&ast, &mut state).unwrap();
assert_eq!(EvaluateVisitor::visit(&ast, &mut state), Ok(Value::Boolean(true)));
let prog = r#"
fn greater_than_five(a: int) -> bool {
if a > 5 {
return true;
}
false
}
greater_than_five(5)
"#;
let ast = program(prog).unwrap();
let mut state = State::default();
SymbolDefineVisitor::visit(&ast, &mut state).unwrap();
TypeComputationVisitor::visit(&ast, &mut state).unwrap();
assert_eq!(EvaluateVisitor::visit(&ast, &mut state), Ok(Value::Boolean(false)));
} | rust_cleaned_test_functions.jsonl/53552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12511,
368,
341,
262,
1077,
29271,
284,
435,
2,
698,
8822,
7046,
51613,
95258,
2877,
25,
526,
8,
1464,
1807,
341,
262,
421,
264,
861,
220,
20,
341,
286,
470,
830,
280,
262,
456,
262,
895,
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_flowcontrol_try_from_usize() {
for value in FlowControl::values() {
let converted = <FlowControl as TryFrom<usize>>::try_from(value as usize).unwrap();
assert_eq!(converted, value);
}
assert!(<FlowControl as TryFrom<usize>>::try_from(IcedConstants::FLOW_CONTROL_ENUM_COUNT).is_err());
assert!(<FlowControl as TryFrom<usize>>::try_from(core::usize::MAX).is_err());
} | rust_cleaned_test_functions.jsonl/5963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27441,
2865,
53283,
5673,
11306,
551,
368,
341,
2023,
897,
304,
22452,
3273,
486,
3661,
368,
341,
197,
10217,
16099,
284,
366,
18878,
3273,
438,
9735,
3830,
90244,
77595,
1539,
5673,
3679,
438,
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... | 2 |
#[test]
fn test_optflag() {
let long_args = vec!["--test".to_string()];
let mut opts = Options::new();
opts.optflag("t", "test", "testing");
match opts.parse(&long_args) {
Ok(ref m) => {
assert!(m.opt_present("test"));
assert!(m.opt_present("t"));
}
_ => panic!(),
}
let short_args = vec!["-t".to_string()];
match opts.parse(&short_args) {
Ok(ref m) => {
assert!(m.opt_present("test"));
assert!(m.opt_present("t"));
}
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/52362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15032,
9903,
368,
341,
262,
1077,
1293,
8384,
284,
7486,
0,
1183,
313,
1944,
3263,
983,
3904,
33800,
262,
1077,
5206,
12185,
284,
14566,
486,
931,
543,
262,
12185,
28102,
9903,
445,
83,
497,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_calculate_weight_skips_root() {
let mut locktower = Locktower::new(EpochStakes::new_for_tests(2), 0, 0.67);
locktower.lockouts.root_slot = Some(1);
let stakes = vec![
(
0,
StakeLockout {
stake: 1,
lockout: 8,
},
),
(
1,
StakeLockout {
stake: 1,
lockout: 8,
},
),
]
.into_iter()
.collect();
assert_eq!(locktower.calculate_weight(&stakes), 0u128);
} | rust_cleaned_test_functions.jsonl/25557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
15876,
33811,
3077,
12993,
368,
341,
286,
1077,
5206,
5296,
77578,
284,
15701,
77578,
486,
931,
10722,
79,
4953,
623,
2050,
486,
931,
5478,
32509,
7,
17,
701,
220,
15,
11,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cubic_duplicated_intersections() {
use std::panic;
let result = panic::catch_unwind(|| {
// the two to be the same if both difference values are < 1e-3.
do_test(
&CubicBezierSegment {
from: point(-33307.36f32, -1804.0625),
ctrl1: point(-59259.727, 70098.31),
ctrl2: point(98661.78, 48235.703),
to: point(28422.234, 31845.219),
},
&CubicBezierSegment {
from: point(-21501.133, 51935.344),
ctrl1: point(-95301.96, 95031.45),
ctrl2: point(-25882.242, -12896.75),
to: point(94618.97, 94288.66),
},
2,
);
});
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/14576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
41181,
814,
98984,
15318,
24661,
368,
341,
262,
990,
1460,
486,
19079,
280,
262,
1077,
1102,
284,
21975,
486,
7173,
4907,
19154,
79453,
341,
1789,
2290,
442,
279,
1378,
311,
387,
279,
1852,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_read() {
let mut data = &base64::decode("IL1ciMu7b3ZOP5Q1cBA7isI=").unwrap()[..];
let payload = PHYPayload::read(Direction::Uplink, &mut data).unwrap();
eprintln!("PAYLOAD {:?}", payload);
} | rust_cleaned_test_functions.jsonl/133319 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
368,
341,
286,
1077,
5206,
821,
284,
609,
3152,
21,
19,
486,
18196,
445,
1715,
16,
5855,
39120,
22,
65,
18,
57,
3067,
20,
48,
16,
66,
7064,
22,
285,
40,
75244,
15454,
10116,
496,
935,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_payload_recover_deserialize() {
let payload_script = Script::from_hex(
"6a4c5045584f4e554d0101d204000000000000e3b0c44298fc1c\
149afbf4c8996fb92427ae41e4649b934ca495991b7852b855e3\
b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca49599\
1b7852b855",
);
let block_hash = hash(&[]);
let prev_txid = Hash::from_slice(block_hash.as_ref()).unwrap();
let payload = Payload::from_script(&payload_script).unwrap();
assert_eq!(payload.block_hash, block_hash);
assert_eq!(payload.block_height, Height(1234));
assert_eq!(payload.prev_tx_chain, Some(prev_txid));
} | rust_cleaned_test_functions.jsonl/119538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32813,
1288,
3688,
15768,
9050,
368,
341,
286,
1077,
7729,
14660,
284,
13710,
486,
1499,
32655,
1006,
310,
330,
21,
64,
19,
66,
20,
15,
19,
20,
20,
23,
19,
69,
19,
68,
20,
20,
19,
67,
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_undefined_opt_present() {
let mut opts = Options::new();
opts.optflag("h", "help", "Description");
let args = vec!["-h"];
match opts.parse(args) {
Ok(matches) => assert!(!matches.opt_present("undefined")),
Err(e) => panic!("{}", e),
}
} | rust_cleaned_test_functions.jsonl/52405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
9614,
15032,
36976,
368,
341,
262,
1077,
5206,
12185,
284,
14566,
486,
931,
543,
262,
12185,
28102,
9903,
445,
71,
497,
330,
8653,
497,
330,
5009,
797,
262,
1077,
2827,
284,
7486,
0,
1183,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_env_windows() {
let mut perms = Permissions::allow_all();
perms.env = UnaryPermission {
global_state: PermissionState::Prompt,
..Permissions::new_env(&Some(svec!["HOME"]), false)
};
set_prompt_result(true);
assert!(perms.env.check("HOME").is_ok());
set_prompt_result(false);
assert!(perms.env.check("HOME").is_ok());
assert!(perms.env.check("hOmE").is_ok());
assert_eq!(
perms.env.revoke(Some(&"HomE".to_string())),
PermissionState::Prompt
);
} | rust_cleaned_test_functions.jsonl/24819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15879,
58220,
368,
341,
262,
1077,
5206,
82282,
284,
53357,
486,
7183,
5705,
543,
262,
82282,
9265,
284,
86951,
14966,
341,
414,
3644,
4387,
25,
18135,
1397,
486,
54615,
345,
414,
5241,
23851,
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_red_setter_oob_panic() {
let mut c1 = Rgi::new(0.2, 0.3, 0.8);
c1.set_red(1.2);
} | rust_cleaned_test_functions.jsonl/86784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26058,
2602,
465,
14179,
674,
620,
31270,
368,
341,
286,
1077,
5206,
272,
16,
284,
431,
8212,
486,
931,
7,
15,
13,
17,
11,
220,
15,
13,
18,
11,
220,
15,
13,
23,
317,
286,
272,
16,
980,
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 |
#[test]
fn test_uint8_to_constraint_field() -> Result<(), SynthesisError> {
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
let max_size = (<Fr as PrimeField>::Params::CAPACITY / 8) as usize;
let modes = [Input, Witness, Constant];
for mode in &modes {
for _ in 0..1000 {
let cs = ConstraintSystem::<Fr>::new_ref();
let bytes: Vec<u8> = (&mut rng)
.sample_iter(&Uniform::new_inclusive(0, u8::max_value()))
.take(max_size * 3 + 5)
.collect();
let bytes_var = bytes
.iter()
.map(|byte| UInt8::new_variable(cs.clone(), || Ok(*byte), *mode))
.collect::<Result<Vec<_>, SynthesisError>>()?;
let f_vec: Vec<Fr> = bytes.to_field_elements().unwrap();
let f_var_vec: Vec<FpVar<Fr>> = bytes_var.to_constraint_field()?;
assert!(cs.is_satisfied().unwrap());
assert_eq!(f_vec, f_var_vec.value()?);
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/55611 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 627
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
23,
2346,
46973,
5013,
368,
1464,
5714,
68843,
23153,
13189,
1454,
29,
341,
286,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
22602,
5673,
7300,
21,
19,
7,
16,
17,
18,
16,
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... | 7 |
#[test]
fn test_total_ord_u8() {
let c = &[1u8, 2, 3];
assert_order!(Greater, &[1u8, 2, 3, 4][..], &c[..]);
let c = &[1u8, 2, 3, 4];
assert_order!(Less, &[1u8, 2, 3][..], &c[..]);
let c = &[1u8, 2, 3, 6];
assert_order!(Equal, &[1u8, 2, 3, 6][..], &c[..]);
let c = &[1u8, 2, 3, 4, 5, 6];
assert_order!(Less, &[1u8, 2, 3, 4, 5, 5, 5, 5][..], &c[..]);
let c = &[1u8, 2, 3, 4];
assert_order!(Greater, &[2u8, 2][..], &c[..]);
} | rust_cleaned_test_functions.jsonl/12881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10784,
67324,
7300,
23,
368,
341,
262,
1077,
272,
284,
44590,
16,
84,
23,
11,
220,
17,
11,
220,
18,
935,
262,
2060,
7869,
10297,
41366,
11,
44590,
16,
84,
23,
11,
220,
17,
11,
220,
18,
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_set_raw_policy() {
let name = "sgx_policy_test.rego";
// Right case
let policy = r#"
package policy
# By default, deny requests.
default allow = false
allow {
mrEnclave_is_grant
mrSigner_is_grant
input.productId >= data.productId
input.svn >= data.svn
}
mrEnclave_is_grant {
count(data.mrEnclave) == 0
}
mrEnclave_is_grant {
count(data.mrEnclave) > 0
input.mrEnclave == data.mrEnclave[_]
}
mrSigner_is_grant {
count(data.mrSigner) == 0
}
mrSigner_is_grant {
count(data.mrSigner) > 0
input.mrSigner == data.mrSigner[_]
}
"#;
let result = set_raw_policy(name, &policy);
assert_eq!(result.unwrap(), ());
let policy = r#"
package policy
# By default, deny requests.
default allow = false
allow {
mrEnclave_is_grant
mrSigner_is_grant
input.productId >= data.productId
input.svn >= data.svn
}
"#;
let result = set_raw_policy(name, &policy);
assert_eq!(result.is_err(), true);
// You can view the content in the src/policy/test1.rego file by yourself
} | rust_cleaned_test_functions.jsonl/84003 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
16067,
22773,
368,
341,
286,
1077,
829,
284,
330,
1991,
87,
22773,
4452,
1327,
3346,
3302,
286,
442,
10083,
1142,
198,
286,
1077,
4842,
284,
435,
2,
698,
1722,
4842,
271,
2,
3216,
1638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.