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_service_query_idle_client_response_failure() {
let mut exec = fuchsia_async::Executor::new().expect("failed to create an executor");
// Create a configured ClientIfaceContainer.
let test_values = test_setup(&mut exec);
let (iface_manager, _stream) = create_iface_manager_with_client(&test_values, true);
// Create other components to run the service.
let iface_manager_client = Arc::new(Mutex::new(FakeIfaceManagerRequester::new()));
let network_selector =
Arc::new(NetworkSelector::new(test_values.saved_networks, create_mock_cobalt_sender()));
// Create mpsc channel to handle requests.
let (mut sender, receiver) = mpsc::channel(1);
let serve_fut = serve_iface_manager_requests(
iface_manager,
iface_manager_client,
network_selector,
receiver,
);
pin_mut!(serve_fut);
// Check if an idle interface is present.
let (idle_iface_sender, idle_iface_receiver) = oneshot::channel();
let req = HasIdleIfaceRequest { responder: idle_iface_sender };
let req = IfaceManagerRequest::HasIdleIface(req);
sender.try_send(req).expect("failed to send request");
// Drop the receiving end and make sure the service continues running.
drop(idle_iface_receiver);
// Run the service loop and expect the request to be serviced and for the loop to not exit.
assert_variant!(exec.run_until_stalled(&mut serve_fut), Poll::Pending);
} | rust_cleaned_test_functions.jsonl/62731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 641
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12267,
5738,
47810,
8179,
9655,
43618,
368,
341,
286,
1077,
5206,
3883,
284,
282,
73391,
28346,
486,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
3071,
286,
442,
4230,
264,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sync() {
let m = Arc::new({
let mut r = TestTypesSingular::default();
r.int32_field = Some(23);
r
});
let threads: Vec<_> = (0..4)
.map(|_| {
let m_copy = m.clone();
thread::spawn(move || {
let mut bytes = Vec::new();
{
let mut writer = Writer::new(&mut bytes);
m_copy.write_message(&mut writer).unwrap();
}
let mut reader = BytesReader::from_bytes(&bytes);
let read = TestTypesSingular::from_reader(&mut reader, &bytes).unwrap();
read.int32_field
})
}).collect();
let results = threads
.into_iter()
.map(|t| t.join().unwrap())
.collect::<Vec<_>>();
assert_eq!(&[Some(23), Some(23), Some(23), Some(23)], &results[..]);
} | rust_cleaned_test_functions.jsonl/24704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 482
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23008,
368,
341,
262,
1077,
296,
284,
19689,
486,
931,
2262,
286,
1077,
5206,
435,
284,
3393,
4173,
50,
41880,
486,
2258,
543,
286,
435,
6403,
18,
17,
5013,
284,
4329,
7,
17,
18,
317,
286,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_import_file() {
// test without tde
do_test_import_file(None);
// test with tde
let (_tmp_dir, key_manager) = new_key_manager_for_test();
do_test_import_file(Some(key_manager));
} | rust_cleaned_test_functions.jsonl/4958 | {
"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,
18434,
2458,
368,
341,
286,
442,
1273,
2041,
259,
450,
198,
286,
653,
4452,
18434,
2458,
26717,
626,
286,
442,
1273,
448,
259,
450,
198,
286,
1077,
5453,
5173,
4334,
11,
1376,
12144,
8,
284,
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 |
#[test]
fn test_space_tag() {
match space_tag("hdwk").easy_parse(" hdwk ") {
Ok((tag, _)) => assert_eq!(tag.as_str(), "hdwk"),
Err(_) => assert!(false),
}
} | rust_cleaned_test_functions.jsonl/103363 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14663,
9372,
368,
341,
286,
2432,
3550,
9372,
445,
15990,
50522,
1827,
45022,
21039,
445,
256,
17907,
50522,
220,
12310,
341,
310,
7622,
1188,
4578,
11,
716,
593,
589,
2060,
10714,
10297,
4578,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uint_from_mul_no_panic() {
assert_eq!(Uint256::from(3) * Uint256::from(2), Uint256::from(6));
} | rust_cleaned_test_functions.jsonl/47736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
5673,
24944,
6536,
620,
31270,
368,
341,
286,
2060,
10714,
10297,
21570,
17,
20,
21,
486,
1499,
7,
18,
8,
353,
27883,
17,
20,
21,
486,
1499,
7,
17,
701,
27883,
17,
20,
21,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_handshake_timeout() {
// Tests that we time out a peer still waiting on handshake completion after a full timer
// tick.
let cfgs = create_peermgr_cfgs(2);
cfgs[0].routing_handler.request_full_sync.store(true, Ordering::Release);
cfgs[1].routing_handler.request_full_sync.store(true, Ordering::Release);
let peers = create_network(2, &cfgs);
let secp_ctx = Secp256k1::new();
let a_id = PublicKey::from_secret_key(&secp_ctx, &peers[0].our_node_secret);
let mut fd_a = FileDescriptor { fd: 1, outbound_data: Arc::new(Mutex::new(Vec::new())) };
let mut fd_b = FileDescriptor { fd: 1, outbound_data: Arc::new(Mutex::new(Vec::new())) };
let initial_data = peers[1].new_outbound_connection(a_id, fd_b.clone()).unwrap();
peers[0].new_inbound_connection(fd_a.clone()).unwrap();
assert_eq!(peers[0].peers.lock().unwrap().peers.len(), 1);
peers[0].timer_tick_occurred();
assert_eq!(peers[0].peers.lock().unwrap().peers.len(), 1);
assert_eq!(peers[0].read_event(&mut fd_a, &initial_data).unwrap(), false);
peers[0].process_events();
assert_eq!(peers[1].read_event(&mut fd_b, &fd_a.outbound_data.lock().unwrap().split_off(0)).unwrap(), false);
peers[1].process_events();
peers[0].timer_tick_occurred();
assert_eq!(peers[0].peers.lock().unwrap().peers.len(), 0);
assert!(peers[0].read_event(&mut fd_a, &fd_b.outbound_data.lock().unwrap().split_off(0)).is_err());
} | rust_cleaned_test_functions.jsonl/57967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 603
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23194,
29661,
20537,
368,
341,
197,
197,
322,
20150,
429,
582,
882,
700,
264,
14397,
2058,
8580,
389,
57020,
9755,
1283,
264,
2480,
9021,
198,
197,
197,
322,
9341,
624,
197,
10217,
13286,
82,
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_double_visit_scan_black() {
let count = std::rc::Rc::new(std::cell::Cell::new(0));
struct A {
count: std::rc::Rc<std::cell::Cell<i32>>,
next_op: Cc<RefCell<Option<A>>>,
}
impl Clone for A {
fn clone(&self) -> Self {
self.count.set(self.count.get() + 1);
A {
count: self.count.clone(),
next_op: self.next_op.clone(),
}
}
}
impl Trace for A {
fn trace(&self, tracer: &mut Tracer) {
self.next_op.trace(tracer);
}
}
impl A {
fn new(count: std::rc::Rc<std::cell::Cell<i32>>, next_op: Option<A>) -> A {
count.set(count.get() + 1);
A {
count,
next_op: Cc::new(RefCell::new(next_op)),
}
}
}
impl Drop for A {
fn drop(&mut self) {
self.count.set(self.count.get() - 1);
}
}
{
let q;
{
let z = A::new(count.clone(), None);
let y = A::new(count.clone(), Some(z.clone()));
let x = A::new(count.clone(), Some(y));
*z.next_op.borrow_mut() = Some(x.clone());
q = x;
}
collect_cycles();
*q.next_op.borrow_mut() = None;
}
collect_cycles();
assert_eq!(count.get(), 0);
} | rust_cleaned_test_functions.jsonl/110859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 973
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
56484,
28857,
40272,
368,
341,
286,
1077,
1760,
284,
1460,
486,
1287,
486,
49,
66,
486,
931,
5194,
486,
5873,
486,
3599,
486,
931,
7,
15,
1106,
286,
2036,
362,
341,
310,
1760,
25,
1460,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_entry() {
let normal_batch_size = 10;
let compressed_batch_size = 5120;
for &entry_size in &[normal_batch_size, compressed_batch_size] {
let dir = tempfile::Builder::new()
.prefix("test_get_entry")
.tempdir()
.unwrap();
let cfg = Config {
dir: dir.path().to_str().unwrap().to_owned(),
target_file_size: ReadableSize(1),
..Default::default()
};
let engine = RaftLogEngine::open(cfg.clone()).unwrap();
let data = vec![b'x'; entry_size];
for i in 10..20 {
let rid = i;
let index = i;
engine.append(rid, index, index + 2, Some(&data));
}
for i in 10..20 {
let rid = i;
let index = i;
engine.scan(rid, index, index + 2, |_, q, d| {
assert_eq!(q, LogQueue::Append);
assert_eq!(d, &data);
});
}
// Recover the engine.
let engine = engine.reopen();
for i in 10..20 {
let rid = i;
let index = i;
engine.scan(rid, index, index + 2, |_, q, d| {
assert_eq!(q, LogQueue::Append);
assert_eq!(d, &data);
});
}
}
} | rust_cleaned_test_functions.jsonl/91521 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 876
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9078,
368,
341,
286,
1077,
4622,
14534,
2368,
284,
220,
16,
15,
280,
286,
1077,
30649,
14534,
2368,
284,
220,
20,
16,
17,
15,
280,
286,
369,
609,
4085,
2368,
304,
44590,
8252,
14534,
236... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_resolve_lock_lite() {
let storage = TestStorageBuilder::new().build().unwrap();
let (tx, rx) = channel();
storage
.async_prewrite(
Context::new(),
vec![
Mutation::Put((Key::from_raw(b"a"), b"foo".to_vec())),
Mutation::Put((Key::from_raw(b"b"), b"foo".to_vec())),
Mutation::Put((Key::from_raw(b"c"), b"foo".to_vec())),
],
b"c".to_vec(),
99,
Options::default(),
expect_ok_callback(tx.clone(), 0),
)
.unwrap();
rx.recv().unwrap();
// Rollback key 'b' and key 'c' and left key 'a' still locked.
let resolve_keys = vec![Key::from_raw(b"b"), Key::from_raw(b"c")];
storage
.async_resolve_lock_lite(
Context::new(),
99,
0,
resolve_keys,
expect_ok_callback(tx.clone(), 0),
)
.unwrap();
rx.recv().unwrap();
// Check lock for key 'a'.
let lock_a = {
let mut lock = LockInfo::new();
lock.set_primary_lock(b"c".to_vec());
lock.set_lock_version(99);
lock.set_key(b"a".to_vec());
lock
};
storage
.async_scan_locks(
Context::new(),
99,
vec![],
0,
expect_value_callback(tx.clone(), 0, vec![lock_a]),
)
.unwrap();
rx.recv().unwrap();
// Resolve lock for key 'a'.
storage
.async_resolve_lock_lite(
Context::new(),
99,
0,
vec![Key::from_raw(b"a")],
expect_ok_callback(tx.clone(), 0),
)
.unwrap();
rx.recv().unwrap();
storage
.async_prewrite(
Context::new(),
vec![
Mutation::Put((Key::from_raw(b"a"), b"foo".to_vec())),
Mutation::Put((Key::from_raw(b"b"), b"foo".to_vec())),
Mutation::Put((Key::from_raw(b"c"), b"foo".to_vec())),
],
b"c".to_vec(),
101,
Options::default(),
expect_ok_callback(tx.clone(), 0),
)
.unwrap();
rx.recv().unwrap();
// Commit key 'b' and key 'c' and left key 'a' still locked.
let resolve_keys = vec![Key::from_raw(b"b"), Key::from_raw(b"c")];
storage
.async_resolve_lock_lite(
Context::new(),
101,
102,
resolve_keys,
expect_ok_callback(tx.clone(), 0),
)
.unwrap();
rx.recv().unwrap();
// Check lock for key 'a'.
let lock_a = {
let mut lock = LockInfo::new();
lock.set_primary_lock(b"c".to_vec());
lock.set_lock_version(101);
lock.set_key(b"a".to_vec());
lock
};
storage
.async_scan_locks(
Context::new(),
101,
vec![],
0,
expect_value_callback(tx.clone(), 0, vec![lock_a]),
)
.unwrap();
rx.recv().unwrap();
} | rust_cleaned_test_functions.jsonl/38074 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
9818,
89191,
368,
341,
286,
1077,
5819,
284,
3393,
5793,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
320,
3998,
11,
19111,
8,
284,
5496,
1428,
286,
5819,
198,
310,
659,
7692,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_with_merge_down() {
let mut trie = RadixTrie::<usize>::new();
trie.insert("exe", 3);
trie.insert("execute", 7);
trie.insert("exec", 4);
trie.insert("example", 7);
trie.remove("exec").expect("Removed exec");
let cute = &trie.entry.children()[0].children()[1].children()[0];
assert_eq!(cute.label(), "cute");
} | rust_cleaned_test_functions.jsonl/41233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
6615,
20888,
13998,
368,
341,
286,
1077,
5206,
59067,
284,
20605,
941,
51,
7231,
27638,
51878,
6831,
931,
543,
286,
59067,
7030,
445,
46184,
497,
220,
18,
317,
286,
59067,
7030,
445,
10257,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_int_value() {
test_ok_types(
move |b| b.become_int_value(1, 1, 2),
&BTreeSet::from_iter(vec![BlockType::Reserved]),
);
let container = [0u8; constants::MIN_ORDER_SIZE];
let block = get_reserved(&container);
assert!(block.become_int_value(1, 2, 3).is_ok());
assert_eq!(block.block_type(), BlockType::IntValue);
assert_eq!(block.name_index().unwrap(), 2);
assert_eq!(block.parent_index().unwrap(), 3);
assert_eq!(block.int_value().unwrap(), 1);
assert_eq!(container[..8], [0x41, 0x03, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00]);
assert_eq!(container[8..], [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
assert!(block.set_int_value(-5).is_ok());
assert_eq!(block.int_value().unwrap(), -5);
assert_eq!(container[..8], [0x41, 0x03, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00]);
assert_eq!(container[8..], [0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]);
let types = BTreeSet::from_iter(vec![BlockType::IntValue]);
test_ok_types(move |b| b.int_value(), &types);
test_ok_types(move |b| b.set_int_value(3), &types);
} | rust_cleaned_test_functions.jsonl/100156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 611
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
3142,
368,
341,
286,
1273,
19817,
9763,
1006,
310,
3271,
760,
65,
91,
293,
948,
51421,
4042,
3142,
7,
16,
11,
220,
16,
11,
220,
17,
1326,
310,
609,
33,
6533,
1649,
486,
1499,
11723,
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_valid_redshift_describe_cluster_snapshots() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"redshift-describe-cluster-snapshots.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = RedshiftClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = DescribeClusterSnapshotsMessage::default();
let result = client.describe_cluster_snapshots(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/12112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
26058,
13418,
15768,
3114,
28441,
74175,
27634,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_spawn() {
let memory = parse(r#"3,15,3,16,1002,16,10,16,1,16,15,15,4,15,99,0,0"#);
let (input_tx, input_rx) = mpsc::channel();
let (output_tx, output_rx) = mpsc::channel();
let cpu = CPU::new(memory, 0, Some(0)).spawn(input_rx, output_tx);
input_tx.send(0).expect("send problem");
assert_eq!(output_rx.recv().expect("recv problem"), 0);
cpu.join()
.expect("paniched")
.unwrap_or_else(|e| panic!("error: {:?}", e));
} | rust_cleaned_test_functions.jsonl/85146 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76026,
368,
341,
286,
1077,
4938,
284,
4715,
2601,
55543,
18,
11,
16,
20,
11,
18,
11,
16,
21,
11,
16,
15,
15,
17,
11,
16,
21,
11,
16,
15,
11,
16,
21,
11,
16,
11,
16,
21,
11,
16,
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_distro_prefix_resolve() {
let prefix = "http://localhost/node/distro/";
let filename = "node.tar.gz";
let hook = DistroHook::Prefix(prefix.to_string());
let version = Version::new(1, 0, 0);
assert_eq!(
hook.resolve(&version, filename)
.expect("Could not resolve URL"),
format!("{}{}", prefix, filename)
);
} | rust_cleaned_test_functions.jsonl/31680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
15561,
13974,
77291,
368,
341,
286,
1077,
9252,
284,
330,
1254,
1110,
8301,
37211,
3446,
15561,
37254,
286,
1077,
3899,
284,
330,
3509,
28048,
20963,
876,
286,
1077,
9704,
284,
422,
15561,
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_mode() {
let mode = |x: MultivariateNormal| x.mode();
test_case(vec![0., 0.], vec![1., 0., 0., 1.], dvec![0., 0.], mode);
test_case(vec![f64::INFINITY, f64::INFINITY], vec![1., 0., 0., 1.], dvec![f64::INFINITY, f64::INFINITY], mode);
} | rust_cleaned_test_functions.jsonl/106555 | {
"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,
7302,
368,
341,
286,
1077,
3856,
284,
760,
87,
25,
22162,
55422,
12206,
91,
856,
22981,
543,
286,
1273,
19096,
25592,
20703,
15,
2572,
220,
15,
13,
1125,
7486,
20703,
16,
2572,
220,
15,
2572,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_account_deserialize() {
let mut rng = rand::thread_rng();
let (account, vote_state) = new_rand_vote_account(&mut rng, None);
let data = bincode::serialize(&account).unwrap();
let vote_account = VoteAccount::from(account);
assert_eq!(vote_state, *vote_account.vote_state().as_ref().unwrap());
let other_vote_account: VoteAccount = bincode::deserialize(&data).unwrap();
assert_eq!(vote_account, other_vote_account);
assert_eq!(
vote_state,
*other_vote_account.vote_state().as_ref().unwrap()
);
} | rust_cleaned_test_functions.jsonl/23433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
13500,
15768,
9050,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
320,
4608,
11,
6910,
4387,
8,
284,
501,
33864,
54360,
13500,
2099,
6984,
28422,
11,
2240,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transpile_jsx_builtin_tags() {
let source = r#"
import React from "https://esm.sh/react"
export default function Index() {
return (
<>
<a href="/about">About</a>
<a href="https://github.com">About</a>
<a href="/about" target="_blank">About</a>
<head>
<link rel="stylesheet" href="../style/index.css" />
</head>
<script src="ga.js"></script>
<script>{`
function gtag() {
dataLayer.push(arguments)
}
window.dataLayer = window.dataLayer || [];
gtag("js", new Date());
gtag("config", "G-1234567890");
`}</script>
</>
)
}
"#;
let (code, resolver) = t("/pages/index.tsx", source, false);
println!("{}", code);
assert!(code.contains(
format!(
"import __ALEPH_Anchor from \"../-/deno.land/x/aleph@v{}/framework/react/anchor.js\"",
VERSION.as_str()
)
.as_str()
));
assert!(code.contains(
format!(
"import __ALEPH_Head from \"../-/deno.land/x/aleph@v{}/framework/react/head.js\"",
VERSION.as_str()
)
.as_str()
));
assert!(code.contains(
format!(
"import __ALEPH_Link from \"../-/deno.land/x/aleph@v{}/framework/react/link.js\"",
VERSION.as_str()
)
.as_str()
));
assert!(code.contains(
format!(
"import __ALEPH_Script from \"../-/deno.land/x/aleph@v{}/framework/react/script.js\"",
VERSION.as_str()
)
.as_str()
));
assert!(code.contains("React.createElement(\"a\","));
assert!(code.contains("React.createElement(__ALEPH_Anchor,"));
assert!(code.contains("React.createElement(__ALEPH_Head,"));
assert!(code.contains("React.createElement(__ALEPH_Link,"));
assert!(code.contains(
format!(
"href: \"../style/index.css.{}.js\"",
HASH_PLACEHOLDER.as_str()
)
.as_str()
));
assert!(code.contains("__url: \"/style/index.css\""));
assert!(code.contains("__base: \"/pages\""));
assert!(code.contains("React.createElement(__ALEPH_Script,"));
let r = resolver.borrow_mut();
assert_eq!(
r.dep_graph,
vec![
DependencyDescriptor {
specifier: "https://esm.sh/react".into(),
is_dynamic: false,
},
DependencyDescriptor {
specifier: "/style/index.css".into(),
is_dynamic: true,
},
DependencyDescriptor {
specifier: format!(
"https://deno.land/x/aleph@v{}/framework/react/anchor.ts",
VERSION.as_str()
),
is_dynamic: false,
},
DependencyDescriptor {
specifier: format!(
"https://deno.land/x/aleph@v{}/framework/react/head.ts",
VERSION.as_str()
),
is_dynamic: false,
},
DependencyDescriptor {
specifier: format!(
"https://deno.land/x/aleph@v{}/framework/react/link.ts",
VERSION.as_str()
),
is_dynamic: false,
},
DependencyDescriptor {
specifier: format!(
"https://deno.land/x/aleph@v{}/framework/react/script.ts",
VERSION.as_str()
),
is_dynamic: false,
}
]
);
} | rust_cleaned_test_functions.jsonl/34197 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1843
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
12192,
26250,
87,
73829,
16333,
368,
341,
262,
1077,
2530,
284,
435,
2,
698,
414,
1159,
3592,
504,
330,
2428,
1110,
288,
76,
2395,
27417,
698,
414,
7485,
1638,
729,
8008,
368,
341,
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... | 2 |
#[test]
fn test_binop_override() {
// won't be used as an empty tuple constructor.
let out: (bool, bool, bool, bool) = rune! {
struct Timeout;
pub fn main() {
let timeout = Timeout;
(
timeout is Timeout,
timeout is not Timeout,
!(timeout is Timeout),
!(timeout is not Timeout),
)
}
};
assert_eq!(out, (true, false, false, true));
} | rust_cleaned_test_functions.jsonl/7282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21816,
453,
48576,
368,
341,
1066,
262,
442,
2765,
944,
387,
1483,
438,
458,
4287,
14405,
4692,
624,
262,
1077,
700,
25,
320,
2641,
11,
1807,
11,
1807,
11,
1807,
8,
284,
63499,
0,
341,
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_from_float() {
use traits::float::FloatCore;
fn test<T: FloatCore>(given: T, (numer, denom): (&str, &str)) {
let ratio: BigRational = Ratio::from_float(given).unwrap();
assert_eq!(
ratio,
Ratio::new(
FromStr::from_str(numer).unwrap(),
FromStr::from_str(denom).unwrap()
)
);
}
// f32
test(3.14159265359f32, ("13176795", "4194304"));
test(2f32.powf(100.), ("1267650600228229401496703205376", "1"));
test(-2f32.powf(100.), ("-1267650600228229401496703205376", "1"));
test(
1.0 / 2f32.powf(100.),
("1", "1267650600228229401496703205376"),
);
test(684729.48391f32, ("1369459", "2"));
test(-8573.5918555f32, ("-4389679", "512"));
// f64
test(3.14159265359f64, ("3537118876014453", "1125899906842624"));
test(2f64.powf(100.), ("1267650600228229401496703205376", "1"));
test(-2f64.powf(100.), ("-1267650600228229401496703205376", "1"));
test(684729.48391f64, ("367611342500051", "536870912"));
test(-8573.5918555f64, ("-4713381968463931", "549755813888"));
test(
1.0 / 2f64.powf(100.),
("1", "1267650600228229401496703205376"),
);
} | rust_cleaned_test_functions.jsonl/839 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 792
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
17586,
368,
341,
286,
990,
24055,
486,
3649,
486,
5442,
5386,
280,
286,
5168,
1273,
3125,
25,
13001,
5386,
2235,
41968,
25,
350,
11,
320,
75596,
11,
49744,
1648,
15899,
495,
11,
609,
495,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_finalized_emer_txs() {
let datadir = test_datadir();
let mut revaultd = dummy_revaultd(datadir.clone(), UserRole::Manager);
setup_db(&mut revaultd).unwrap();
let db_file = revaultd.db_file();
let vaults = create_vaults(&revaultd);
// vault[2]
let mut emer2 = vaults[2]
.transactions
.as_ref()
.unwrap()
.final_emer
.clone()
.unwrap();
emer2.finalize(&revaultd.secp_ctx).unwrap();
let emer2 = emer2.into_psbt().extract_tx();
let mut unvault_emer2 = vaults[2]
.transactions
.as_ref()
.unwrap()
.final_unvault_emer
.clone()
.unwrap();
unvault_emer2.finalize(&revaultd.secp_ctx).unwrap();
let unvault_emer2 = unvault_emer2.into_psbt().extract_tx();
// vault[3]
let mut emer3 = vaults[3]
.transactions
.as_ref()
.unwrap()
.final_emer
.clone()
.unwrap();
emer3.finalize(&revaultd.secp_ctx).unwrap();
let emer3 = emer3.into_psbt().extract_tx();
let mut unvault_emer3 = vaults[3]
.transactions
.as_ref()
.unwrap()
.final_unvault_emer
.clone()
.unwrap();
unvault_emer3.finalize(&revaultd.secp_ctx).unwrap();
let unvault_emer3 = unvault_emer3.into_psbt().extract_tx();
let txs = finalized_emer_txs(&revaultd).unwrap();
// One secured vault and one active vault
assert_eq!(txs.len(), 2);
assert!(txs.contains(&emer2));
assert!(txs.contains(&emer3));
// unvault!)
db_confirm_unvault(
&db_file,
&vaults[2]
.transactions
.as_ref()
.unwrap()
.initial_unvault
.psbt()
.global
.unsigned_tx
.txid(),
)
.unwrap();
// I will get one emer and one unvault_emer
let txs = finalized_emer_txs(&revaultd).unwrap();
assert_eq!(txs.len(), 2);
assert!(txs.contains(&unvault_emer2));
assert!(txs.contains(&emer3));
db_confirm_unvault(
&db_file,
&vaults[3]
.transactions
.as_ref()
.unwrap()
.initial_unvault
.psbt()
.global
.unsigned_tx
.txid(),
)
.unwrap();
// Two unvault emer!
let txs = finalized_emer_txs(&revaultd).unwrap();
assert_eq!(txs.len(), 2);
assert!(txs.contains(&unvault_emer2));
assert!(txs.contains(&unvault_emer3));
fs::remove_dir_all(&datadir).unwrap();
} | rust_cleaned_test_functions.jsonl/31170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1731
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20676,
1506,
22504,
261,
17805,
82,
368,
341,
286,
1077,
3258,
41173,
284,
1273,
15353,
41173,
543,
286,
1077,
5206,
5772,
945,
67,
284,
17292,
38082,
945,
67,
44841,
41173,
15997,
1507,
95019,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_one_invalid_signature() {
let vp_calculator = ProdVotingPowerCalculator::default();
let trust_threshold = TrustThreshold::default();
let mut testgen_lb = TestgenLightBlock::new_default(10);
let mut commit = testgen_lb.commit.clone().unwrap();
let mut votes = commit.votes.unwrap();
let vote = votes.pop().unwrap();
let header = vote.clone().header.unwrap().chain_id("bad-chain");
votes.push(vote.header(header));
commit.votes = Some(votes);
testgen_lb.commit = Some(commit);
let light_block: LightBlock = testgen_lb.generate().unwrap().into();
let result_err = vp_calculator.voting_power_in(
&light_block.signed_header,
&light_block.validators,
trust_threshold,
);
match result_err {
Err(VerificationError(VerificationErrorDetail::InvalidSignature(_), _)) => {}
_ => panic!("expected InvalidSignature error"),
}
} | rust_cleaned_test_functions.jsonl/35060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
31433,
39859,
368,
341,
286,
1077,
34823,
24005,
20022,
284,
71272,
53,
11519,
14986,
55743,
486,
2258,
543,
286,
1077,
6950,
21858,
284,
16816,
37841,
486,
2258,
1428,
286,
1077,
5206,
1273,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sqrt() {
// a = 1488924004771393321054797166853618474668089414631333405711627789629391903630694737978065425271543178763948256226639*u + 784063022264861764559335808165825052288770346101304131934508881646553551234697082295473567906267937225174620141295
let a = Fp2 {
c0: Fp::from_raw_unchecked([
0x2bee_d146_27d7_f9e9,
0xb661_4e06_660e_5dce,
0x06c4_cc7c_2f91_d42c,
0x996d_7847_4b7a_63cc,
0xebae_bc4c_820d_574e,
0x1886_5e12_d93f_d845,
]),
c1: Fp::from_raw_unchecked([
0x7d82_8664_baf4_f566,
0xd17e_6639_96ec_7339,
0x679e_ad55_cb40_78d0,
0xfe3b_2260_e001_ec28,
0x3059_93d0_43d9_1b68,
0x0626_f03c_0489_b72d,
]),
};
assert_eq!(a.sqrt().unwrap().square(), a);
// multiplicative subgroup
let b = Fp2 {
c0: Fp::from_raw_unchecked([
0x6631_0000_0010_5545,
0x2114_0040_0eec_000d,
0x3fa7_af30_c820_e316,
0xc52a_8b8d_6387_695d,
0x9fb4_e61d_1e83_eac5,
0x005c_b922_afe8_4dc7,
]),
c1: Fp::zero(),
};
assert_eq!(b.sqrt().unwrap().square(), b);
// multiplicative subgroup
let c = Fp2 {
c0: Fp::from_raw_unchecked([
0x44f6_0000_0051_ffae,
0x86b8_0141_9948_0043,
0xd715_9952_f1f3_794a,
0x755d_6e3d_fe1f_fc12,
0xd36c_d6db_5547_e905,
0x02f8_c8ec_bf18_67bb,
]),
c1: Fp::zero(),
};
assert_eq!(c.sqrt().unwrap().square(), c);
// 2155129644831861015726826462986972654175647013268275306775721078997042729172900466542651176384766902407257452753362*u + 2796889544896299244102912275102369318775038861758288697415827248356648685135290329705805931514906495247464901062529
// is nonsquare.
assert!(bool::from(
Fp2 {
c0: Fp::from_raw_unchecked([
0xc5fa_1bc8_fd00_d7f6,
0x3830_ca45_4606_003b,
0x2b28_7f11_04b1_02da,
0xa7fb_30f2_8230_f23e,
0x339c_db9e_e953_dbf0,
0x0d78_ec51_d989_fc57,
]),
c1: Fp::from_raw_unchecked([
0x27ec_4898_cf87_f613,
0x9de1_394e_1abb_05a5,
0x0947_f85d_c170_fc14,
0x586f_bc69_6b61_14b7,
0x2b34_75a4_077d_7169,
0x13e1_c895_cc4b_6c22,
])
}
.sqrt()
.is_none()
));
} | rust_cleaned_test_functions.jsonl/32511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1729
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92199,
368,
341,
262,
442,
264,
284,
220,
16,
19,
23,
23,
24,
17,
19,
15,
15,
19,
22,
22,
16,
18,
24,
18,
18,
17,
16,
15,
20,
19,
22,
24,
22,
16,
21,
21,
23,
20,
18,
21,
16,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_heartbeat_timeout_unknown_participant() {
let mut protocol = Protocol::new(get_default_fl_settings());
let client_id = ClientId::new();
protocol.heartbeat_timeout(client_id, ClientState::Unknown);
let counters = protocol.counters();
let expected = Counters {
..Default::default()
};
assert_eq!(counters, expected);
assert!(protocol.next_event().is_none());
} | rust_cleaned_test_functions.jsonl/97769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
72471,
20537,
57507,
10495,
21757,
368,
341,
286,
1077,
5206,
11507,
284,
24572,
486,
931,
5433,
9993,
5081,
10853,
1423,
286,
1077,
2943,
842,
284,
8423,
764,
486,
931,
1428,
286,
11507,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cpu_time_interval() {
let t_a = CPUTimes {
user_usec: 12345,
system_usec: 54321,
};
let t_b = CPUTimes {
user_usec: 20000,
system_usec: 70000,
};
let t_zero = cpu_time_interval(&t_a, &t_a);
assert_eq!(0.0, t_zero.user);
assert_eq!(0.0, t_zero.system);
let t_ab = cpu_time_interval(&t_a, &t_b);
assert_relative_eq!(0.007655, t_ab.user);
assert_relative_eq!(0.015679, t_ab.system);
let t_ba = cpu_time_interval(&t_b, &t_a);
assert_relative_eq!(-0.007655, t_ba.user);
assert_relative_eq!(-0.015679, t_ba.system);
} | rust_cleaned_test_functions.jsonl/45032 | {
"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,
21795,
3009,
20541,
368,
341,
262,
1077,
259,
4306,
284,
356,
6221,
1733,
341,
286,
1196,
43047,
25,
220,
16,
17,
18,
19,
20,
345,
286,
1849,
43047,
25,
220,
20,
19,
18,
17,
16,
345,
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_iterate_string_vec() {
let words = vec!["hello", "world"];
let capitalized_words: Vec<String> = vec![String::from("Hello"), "World".to_string()];
assert_eq!(capitalized_words, ["Hello", "World"]);
} | rust_cleaned_test_functions.jsonl/48521 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
3904,
13251,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
14615,
6332,
286,
1077,
97321,
18981,
25,
11312,
3464,
29,
284,
7486,
20703,
703,
486,
1499,
445,
9707,
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_init_with_file_no_payment_method() {
init!("false");
settings::clear_config();
let config_path = "/tmp/test_init.json";
let content = json!({
"wallet_name": settings::DEFAULT_WALLET_NAME,
"wallet_key": settings::DEFAULT_WALLET_KEY
}).to_string();
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::MISSING_PAYMENT_METHOD.code_num);
} | rust_cleaned_test_functions.jsonl/127526 | {
"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,
6137,
6615,
2458,
6536,
26696,
9032,
368,
341,
286,
2930,
17223,
3849,
797,
286,
5003,
486,
7422,
5332,
1428,
286,
1077,
2193,
2638,
284,
3521,
5173,
12697,
6137,
4323,
876,
286,
1077,
2213,
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_points() {
// note: storage_points == storage_credits
let credits = 42;
let mut storage_accounts = StorageAccounts::default();
assert_eq!(storage_accounts.points(), 0);
assert_eq!(storage_accounts.claim_points(), 0);
// create random validator and archiver accounts with `credits`
let ((validator_pubkey, validator_account), (archiver_pubkey, archiver_account)) =
create_storage_accounts_with_credits(credits);
storage_accounts.store(&validator_pubkey, &validator_account);
storage_accounts.store(&archiver_pubkey, &archiver_account);
// check that 2x credits worth of points are available
assert_eq!(storage_accounts.points(), credits * 2);
let ((validator_pubkey, validator_account), (archiver_pubkey, mut archiver_account)) =
create_storage_accounts_with_credits(credits);
storage_accounts.store(&validator_pubkey, &validator_account);
storage_accounts.store(&archiver_pubkey, &archiver_account);
// check that 4x credits worth of points are available
assert_eq!(storage_accounts.points(), credits * 2 * 2);
storage_accounts.store(&validator_pubkey, &validator_account);
storage_accounts.store(&archiver_pubkey, &archiver_account);
// check that storing again has no effect
assert_eq!(storage_accounts.points(), credits * 2 * 2);
let storage_contract = &mut archiver_account.state().unwrap();
if let StorageContract::ArchiverStorage {
credits: account_credits,
..
} = storage_contract
{
account_credits.current_epoch += 1;
}
archiver_account.set_state(storage_contract).unwrap();
storage_accounts.store(&archiver_pubkey, &archiver_account);
// check that incremental store increases credits
assert_eq!(storage_accounts.points(), credits * 2 * 2 + 1);
assert_eq!(storage_accounts.claim_points(), credits * 2 * 2 + 1);
assert_eq!(storage_accounts.claim_points(), 0);
} | rust_cleaned_test_functions.jsonl/38770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 844
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12928,
368,
341,
286,
442,
5185,
25,
5819,
12928,
621,
5819,
666,
29502,
198,
286,
1077,
20141,
284,
220,
19,
17,
280,
286,
1077,
5206,
5819,
55665,
284,
14693,
41369,
486,
2258,
543,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_required_unless_valid_nested() {
let mut test = Map::new();
test.assign("required", Value::String("true".to_owned())).ok();
test.assign("other", Value::Boolean(false)).ok();
let mut params = Map::new();
params.assign("test", Value::Map(test)).ok();
let mut rules = BTreeMap::new();
rules.insert("test.required",
vec![Rule::RequiredUnless("test.other", Value::Boolean(true))]);
let result = validate(&rules, params);
assert!(result.is_ok());
assert_eq!(result.unwrap().find(&["test", "required"]).unwrap(),
&Value::String("true".to_owned()));
} | rust_cleaned_test_functions.jsonl/108931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18743,
4907,
1717,
8337,
66279,
368,
341,
262,
1077,
5206,
1273,
284,
5027,
486,
931,
543,
262,
1273,
17870,
445,
6279,
497,
5162,
486,
703,
445,
1866,
3263,
983,
51973,
34670,
562,
543,
262,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_winning_post_2kib_base_8() -> Result<()> {
winning_post::<SectorShape2KiB>(SECTOR_SIZE_2_KIB, false)?;
winning_post::<SectorShape2KiB>(SECTOR_SIZE_2_KIB, true)
} | rust_cleaned_test_functions.jsonl/4372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
19770,
6333,
62,
17,
74,
579,
7651,
62,
23,
368,
1464,
5714,
71698,
341,
262,
10987,
6333,
27638,
68188,
12301,
17,
72572,
33,
2235,
925,
26275,
4098,
62,
17,
10102,
3256,
11,
895,
40007,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fq2_legendre() {
use ff::LegendreSymbol::*;
assert_eq!(Zero, Fq2::zero().legendre());
// i^2 = -1
let mut m1 = Fq2::one();
m1.negate();
assert_eq!(QuadraticResidue, m1.legendre());
m1.mul_by_nonresidue();
assert_eq!(QuadraticNonResidue, m1.legendre());
} | rust_cleaned_test_functions.jsonl/100948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
17,
76612,
265,
368,
341,
262,
990,
25539,
486,
39675,
265,
15090,
79304,
262,
2060,
10714,
10297,
17999,
11,
434,
80,
17,
486,
14154,
1005,
14505,
265,
1423,
262,
442,
600,
61,
17,
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_extended_niels_point_identity() {
assert_eq!(
ExtendedNielsPoint::identity().v_plus_u,
ExtendedPoint::identity().to_niels().v_plus_u
);
assert_eq!(
ExtendedNielsPoint::identity().v_minus_u,
ExtendedPoint::identity().to_niels().v_minus_u
);
assert_eq!(
ExtendedNielsPoint::identity().z,
ExtendedPoint::identity().to_niels().z
);
assert_eq!(
ExtendedNielsPoint::identity().t2d,
ExtendedPoint::identity().to_niels().t2d
);
} | rust_cleaned_test_functions.jsonl/103797 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61678,
1089,
72,
2010,
6085,
46244,
368,
341,
262,
2060,
10714,
33673,
286,
40565,
56494,
2010,
2609,
486,
16912,
1005,
85,
28043,
7300,
345,
286,
40565,
2609,
486,
16912,
1005,
983,
1089,
72,
201... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_roundtrip_std() {
let msg_orig = MsgType { a: 12345 };
let buf = serialize_msg_owned(&msg_orig).unwrap();
let msg_actual = deserialize_owned(&buf).unwrap();
assert_eq!(msg_orig, msg_actual);
} | rust_cleaned_test_functions.jsonl/58582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
32981,
15656,
368,
341,
262,
1077,
3750,
35328,
284,
24205,
929,
314,
264,
25,
220,
16,
17,
18,
19,
20,
3634,
262,
1077,
6607,
284,
24235,
6483,
51973,
2099,
3236,
35328,
568,
15454,
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_condition() {
let mut builder = ConditionBuilder::new();
let condition = builder
.and(Condition::Cmp(CmpCondition::new(1, CmpOp::GreaterEqual, Property::Int(2))))
.and(Condition::Cmp(CmpCondition::new(1, CmpOp::LessEqual, Property::Int(10))))
.or(Condition::Cmp(CmpCondition::new(2, CmpOp::Equal, Property::String("xxx".to_owned()))))
.build().unwrap();
println!("{:?}", condition);
} | rust_cleaned_test_functions.jsonl/76689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27656,
368,
341,
262,
1077,
5206,
7363,
284,
15180,
3297,
486,
931,
1428,
1066,
262,
1077,
2971,
284,
7363,
198,
286,
659,
437,
7,
10547,
486,
34,
1307,
3025,
1307,
10547,
486,
931,
7,
16,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_facet_missing_facet() -> Result<(), Error> {
let meta = json!({});
let f = test_facet(&meta);
assert!(f.is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/120017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41589,
295,
40447,
41589,
295,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
8823,
284,
2951,
0,
48109,
286,
1077,
282,
284,
1273,
41589,
295,
2099,
5490,
317,
286,
2060,
10297,
69,
2079,
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 |
#[test]
fn test_lookups() {
let mut ips: Vec<Ipv4Addr> = Vec::new();
ips.insert(0, "8.8.8.8".parse().unwrap());
let mut nets: Vec<Ipv4Network> = Vec::new();
nets.insert(0, "8.8.8.8/8".parse().unwrap());
let ip: Ipv4Addr = "8.8.8.8".parse().unwrap();
let ip2: Ipv4Addr = "1.1.1.1".parse().unwrap();
let net: Ipv4Network = "8.8.8.8/8".parse().unwrap();
let net2: Ipv4Network = "1.1.1.1/8".parse().unwrap();
assert!(ips.lookup_by_ip(ip), "ips - lookup_by_ip is not eq");
assert!(!ips.lookup_by_ip(ip2), "ips - lookup_by_ip is not neq");
assert!(ips.lookup_by_net(net), "ips - lookup_by_net is not eq");
assert!(!ips.lookup_by_net(net2), "ips - lookup_by_net is not neq");
assert!(nets.lookup_by_ip(ip), "nets - lookup_by_ip is not eq");
assert!(nets.lookup_by_net(net), "nets - lookup_by_net is not eq");
assert!(!nets.lookup_by_ip(ip2), "nets - lookup_by_ip is not neq");
assert!(!nets.lookup_by_net(net2), "nets - lookup_by_net is not neq");
} | rust_cleaned_test_functions.jsonl/116392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24271,
8602,
368,
341,
262,
1077,
5206,
59022,
25,
11312,
13332,
30168,
19,
13986,
29,
284,
11312,
486,
931,
543,
262,
59022,
7030,
7,
15,
11,
330,
23,
13,
23,
13,
23,
13,
23,
3263,
6400,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_catch_finally() {
test_same("try {foo()} catch (e) {bar()}");
test_same("try { try {foo()} catch (e) {bar()}} catch (x) {bar()}");
test("try {var x = 1} finally {}", "var x = 1;");
test_same("try {var x = 1} finally {x()}");
test(
"function f() { return; try{var x = 1}finally{} }",
"function f() { var x; return; }",
);
test("try {} finally {x()}", "x()");
test("try {} catch (e) { bar()} finally {x()}", "x()");
test("try {} catch (e) { bar()}", "");
test(
"try {} catch (e) { var a = 0; } finally {x()}",
"var a; x()",
);
test("try {} catch (e) {}", "");
test("try {} finally {}", "");
test("try {} catch (e) {} finally {}", "");
} | rust_cleaned_test_functions.jsonl/468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
666,
754,
761,
37645,
368,
341,
262,
1273,
33574,
445,
1539,
314,
7975,
21783,
2287,
320,
68,
8,
314,
2257,
368,
20305,
262,
1273,
33574,
445,
1539,
314,
1430,
314,
7975,
21783,
2287,
320... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_optimize_filters_for_hits() {
let path = tempdir_with_prefix("_rust_rocksdb_optimize_filters_for_hits");
let mut opts = DBOptions::new();
let mut cf_opts = ColumnFamilyOptions::new();
opts.create_if_missing(true);
cf_opts.set_optimize_filters_for_hits(true);
DB::open_cf(
opts,
path.path().to_str().unwrap(),
vec![("default", cf_opts)],
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/34105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
15032,
11853,
22481,
5478,
63832,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
15032,
11853,
22481,
5478,
63832,
797,
262,
1077,
5206,
12185,
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_fq_negate() {
{
let a = -Fq::zero();
assert!(a.is_zero());
}
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
for _ in 0..1000 {
let mut a = Fq::rand(&mut rng);
let b = -a;
a.add_assign(&b);
assert!(a.is_zero());
}
} | rust_cleaned_test_functions.jsonl/27353 | {
"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,
761,
80,
28209,
349,
368,
341,
262,
341,
286,
1077,
264,
284,
481,
37,
80,
486,
14154,
1428,
286,
2060,
10297,
64,
2079,
19359,
1423,
262,
555,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_to_second() {
let a: PrimitiveArray<Timestamp32Type> =
vec![Some(0), Some(325), None, Some(7849)].into();
let b = timestamp32_to_second(&a, Some(0)).unwrap();
assert_eq!(0, b.value(0));
assert_eq!(25, b.value(1));
assert_eq!(false, b.is_valid(2));
assert_eq!(49, b.value(3));
} | rust_cleaned_test_functions.jsonl/109399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
29644,
368,
341,
286,
1077,
264,
25,
51460,
1857,
3125,
4702,
18,
17,
929,
29,
4035,
310,
7486,
20703,
8373,
7,
15,
701,
4329,
7,
18,
17,
20,
701,
2240,
11,
4329,
7,
22,
23,
19,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_remote_addr() {
let socket = std::net::SocketAddr::new(
std::net::IpAddr::V4(std::net::Ipv4Addr::new(7, 7, 7, 7)),
7777,
);
let socket_result = Some("7.7.7.7:7777".to_string());
assert_eq!(Some(socket.to_string()), socket_result);
let headers_without_forwarded = warp::http::HeaderMap::new();
assert_eq!(
get_remote_addr(&headers_without_forwarded, Some(&socket)),
socket_result
);
assert_eq!(get_remote_addr(&headers_without_forwarded, None), None);
let forwarded_value = "forwarded".to_string();
let forwarded_header = warp::http::header::HeaderValue::from_str(&forwarded_value).unwrap();
let forwarded_result = Some(forwarded_value);
assert_eq!(
Some(forwarded_header.to_str().unwrap().to_string()),
forwarded_result
);
let mut headers_with_forwarded = warp::http::HeaderMap::new();
headers_with_forwarded.insert(warp::http::header::FORWARDED, forwarded_header);
assert_eq!(
get_remote_addr(&headers_with_forwarded, None),
forwarded_result
);
assert_eq!(
get_remote_addr(&headers_with_forwarded, Some(&socket)),
forwarded_result
);
// someone is being a naughty
let mut headers_with_invalid_forwarded = warp::http::HeaderMap::new();
headers_with_invalid_forwarded.insert(
warp::http::header::FORWARDED,
warp::http::header::HeaderValue::from_str("хулиган").unwrap(),
);
assert_eq!(get_remote_addr(&headers_with_invalid_forwarded, None), None);
assert_eq!(
get_remote_addr(&headers_with_invalid_forwarded, Some(&socket)),
socket_result
);
} | rust_cleaned_test_functions.jsonl/99115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 695
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
36425,
7387,
368,
341,
262,
1077,
7575,
284,
1460,
486,
4711,
486,
10286,
13986,
486,
931,
1006,
286,
1460,
486,
4711,
486,
23378,
13986,
486,
53,
19,
5194,
486,
4711,
486,
80656,
19,
1398... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fastq_none_after_err() {
let mut reader = Reader::new(&b"@id\nATGC"[..]);
assert!(reader.next().unwrap().is_err());
assert!(reader.next().is_none());
} | rust_cleaned_test_functions.jsonl/40335 | {
"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,
35743,
80,
31488,
19844,
9266,
368,
341,
262,
1077,
5206,
6604,
284,
25166,
486,
931,
2099,
65,
96270,
307,
1699,
828,
22863,
36864,
496,
2558,
262,
2060,
10297,
11149,
4529,
1005,
15454,
1005,
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 |
#[test]
fn test_create_replica_shard() {
let test_primary_shard = PrimaryShard::new();
let test_replica_shard = ReplicaShard::new(test_primary_shard.shard_id());
assert!(!test_replica_shard.is_primary());
} | rust_cleaned_test_functions.jsonl/121593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25533,
15317,
3712,
567,
368,
341,
286,
1077,
1273,
45314,
3712,
567,
284,
25094,
2016,
567,
486,
931,
543,
286,
1077,
1273,
25533,
15317,
3712,
567,
284,
94036,
2016,
567,
486,
931,
8623,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_read_gdef_zero_classdef_offset() {
let data = make_gdef_header(0);
let gdef = ReadScope::new(&data).read::<GDEFTable>().unwrap();
assert!(gdef.opt_glyph_classdef.is_none());
} | rust_cleaned_test_functions.jsonl/93744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
1889,
750,
19359,
4790,
750,
6917,
368,
341,
286,
1077,
821,
284,
1281,
1889,
750,
8757,
7,
15,
317,
286,
1077,
342,
750,
284,
4457,
10803,
486,
931,
2099,
691,
568,
878,
27638,
38,
1364... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_term_query() {
let query = QueryRequest::new().with_query(Query::term("bla", "blub"));
let json = serde_json::to_string(&query).unwrap();
assert_that(&json.as_str()).is_equal_to(r#"{"query":{"term":{"bla":"blub"}}}"#);
let actual = serde_json::from_str::<QueryRequest>(&json).unwrap();
assert_that(&actual).is_equal_to(query);
} | rust_cleaned_test_functions.jsonl/35088 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17464,
5738,
368,
341,
220,
1077,
3239,
284,
11361,
1900,
486,
931,
1005,
4197,
5738,
59036,
486,
4991,
445,
64726,
497,
330,
2024,
392,
4010,
220,
1077,
2951,
284,
61570,
9455,
486,
983,
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_certs() {
let cert_bits = botan::hex_decode("3082035A30820305A003020102020101300C06082A8648CE3D04030105003050310B3009060355040613024445310D300B060355040A0C0462756E64310C300A060355040B0C03627369310D300B06035504051304343536373115301306035504030C0C637363612D6765726D616E79301E170D3037303731393135323731385A170D3238303131393135313830305A3050310B3009060355040613024445310D300B060355040A0C0462756E64310C300A060355040B0C03627369310D300B06035504051304343536373115301306035504030C0C637363612D6765726D616E79308201133081D406072A8648CE3D02013081C8020101302806072A8648CE3D0101021D00D7C134AA264366862A18302575D1D787B09F075797DA89F57EC8C0FF303C041C68A5E62CA9CE6C1C299803A6C1530B514E182AD8B0042A59CAD29F43041C2580F63CCFE44138870713B1A92369E33E2135D266DBB372386C400B0439040D9029AD2C7E5CF4340823B2A87DC68C9E4CE3174C1E6EFDEE12C07D58AA56F772C0726F24C6B89E4ECDAC24354B9E99CAA3F6D3761402CD021D00D7C134AA264366862A18302575D0FB98D116BC4B6DDEBCA3A5A7939F020101033A000401364A4B0F0102E9502AB9DC6855D90B065A6F5E5E48395F8309D57C11ABAFF21756607EF6757EC9886CA222D83CA04B1A99FA43C5A9BCE1A38201103082010C30360603551D11042F302D8118637363612D6765726D616E79406273692E62756E642E646586116661783A2B343932323839353832373232300E0603551D0F0101FF040403020106301D0603551D0E041604140096452DE588F966C4CCDF161DD1F3F5341B71E7301F0603551D230418301680140096452DE588F966C4CCDF161DD1F3F5341B71E730410603551D20043A30383036060904007F0007030101013029302706082B06010505070201161B687474703A2F2F7777772E6273692E62756E642E64652F6373636130120603551D130101FF040830060101FF020100302B0603551D1004243022800F32303037303731393135323731385A810F32303237313131393135313830305A300C06082A8648CE3D0403010500034100303E021D00C6B41E830217FD4C93B59E9E2B13734E09C182FA63FAEE4115A8EDD5021D00D27938DA01B8951A9064A1B696AEDF181B74968829C138F0EB2F623B").unwrap();
let cert = botan::Certificate::load(&cert_bits).unwrap();
let key_id = botan::hex_decode("0096452DE588F966C4CCDF161DD1F3F5341B71E7").unwrap();
assert_eq!(cert.serial_number().unwrap(), vec![1]);
assert_eq!(cert.authority_key_id().unwrap(), key_id);
assert_eq!(cert.subject_key_id().unwrap(), key_id);
assert_eq!(cert.allows_usage(botan::CertUsage::CertificateSign).unwrap(), true);
assert_eq!(cert.allows_usage(botan::CertUsage::CrlSign).unwrap(), true);
assert_eq!(cert.allows_usage(botan::CertUsage::KeyEncipherment).unwrap(), false);
let pubkey = cert.public_key().unwrap();
assert_eq!(pubkey.algo_name().unwrap(), "ECDSA");
} | rust_cleaned_test_functions.jsonl/95298 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
15546,
368,
341,
262,
1077,
2777,
20034,
284,
10924,
276,
486,
17308,
15227,
445,
18,
15,
23,
17,
15,
18,
20,
32,
18,
15,
23,
17,
15,
18,
15,
20,
32,
15,
15,
18,
15,
17,
15,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_point_region() {
let p = Point(Vector::new(1., 0., 0.));
let r = Point(Vector::new(1., 0., 0.));
assert!(r.contains(&p));
assert!(p.contains(&r));
assert_eq!(false, r.contains(&Point(Vector::new(1., 0., 1.))));
assert!(r.cap_bound().approx_eq(&Cap::from(&r)));
assert!(r.rect_bound().approx_eq(&Rect::from(LatLng::from(&p))));
let cell = Cell::from(&p);
assert_eq!(false, r.contains_cell(&cell));
assert_eq!(true, r.intersects_cell(&cell));
} | rust_cleaned_test_functions.jsonl/70563 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6085,
20627,
368,
341,
286,
1077,
281,
284,
5126,
20258,
486,
931,
7,
16,
2572,
220,
15,
2572,
220,
15,
13,
1106,
286,
1077,
435,
284,
5126,
20258,
486,
931,
7,
16,
2572,
220,
15,
2572,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_pop() {
match decode_16(0xbd10) {
Instruction::POP { registers, thumb32 } => {
let elems: Vec<_> = registers.iter().collect();
assert_eq!(vec![Reg::R4, Reg::PC], elems);
assert_eq!(thumb32, false);
}
_ => {
assert!(false);
}
}
} | rust_cleaned_test_functions.jsonl/64744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
17061,
368,
341,
1066,
262,
2432,
16895,
62,
16,
21,
7,
15,
33564,
16,
15,
8,
341,
286,
29051,
486,
47262,
314,
24740,
11,
24050,
18,
17,
335,
589,
341,
310,
1077,
55968,
25,
11312,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_file_exists() {
let tmp_dir = TempDir::new("").unwrap();
let dir_path = tmp_dir.path().to_path_buf();
assert_eq!(file_exists(&dir_path), false);
let existent_file = dir_path.join("empty_file");
{
let _ = OpenOptions::new()
.write(true)
.create_new(true)
.open(&existent_file)
.unwrap();
}
assert_eq!(file_exists(&existent_file), true);
let non_existent_file = dir_path.join("non_existent_file");
assert_eq!(file_exists(&non_existent_file), false);
} | rust_cleaned_test_functions.jsonl/15182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
9766,
368,
341,
286,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
80821,
15454,
543,
286,
1077,
5419,
2638,
284,
4174,
4334,
3875,
1005,
983,
2638,
10363,
1428,
286,
2060,
10714,
10297,
119... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_paths_larger_sample() {
let inputs = read_lines("data/day_12_larger_sample.txt");
let (_, cave_edges) = parse_cave_system(&inputs);
let paths = all_paths(&cave_edges, 1);
assert_eq!(paths.len(), 19);
let paths = all_paths(&cave_edges, 2);
assert_eq!(paths.len(), 103);
} | rust_cleaned_test_functions.jsonl/42448 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
24152,
907,
41776,
17491,
368,
341,
262,
1077,
11127,
284,
1349,
18323,
445,
691,
44739,
62,
16,
17,
907,
41776,
17491,
3909,
797,
262,
1077,
39464,
25385,
28026,
8,
284,
4715,
666,
523,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ignored_gossipsub_score() {
let mut score = Score::default();
score.update_gossipsub_score(GOSSIPSUB_GREYLIST_THRESHOLD, true);
assert!(!score.is_good_gossipsub_peer());
assert_eq!(score.score(), 0.0);
} | rust_cleaned_test_functions.jsonl/93742 | {
"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,
62,
58471,
1889,
41473,
1966,
10405,
368,
341,
286,
1077,
5206,
5456,
284,
18115,
486,
2258,
543,
286,
5456,
5317,
1889,
41473,
1966,
10405,
6699,
46,
1220,
25944,
4493,
72739,
56,
22852,
44405,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_generic_message_fails_with_invalid_connection() {
let _setup = SetupMocks::init();
let handle = ::connection::tests::build_test_connection();
let err = send_generic_message(handle, "this is the message", &json!({"msg_type":"type", "msg_title": "title", "ref_msg_id":null}).to_string()).unwrap_err();
assert_eq!(err.kind(), VcxErrorKind::NotReady);
} | rust_cleaned_test_functions.jsonl/124203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
41232,
6462,
761,
6209,
6615,
31433,
15866,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
3705,
284,
3504,
7742,
486,
23841,
486,
5834,
4452,
15866,
1428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_paren_expr() {
test_walk(
"(a + b)",
vec![
"File",
"ExprStmt",
"ParenExpr",
"BinaryExpr",
"Identifier",
"Identifier",
],
)
} | rust_cleaned_test_functions.jsonl/133859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
9151,
21915,
368,
341,
262,
1273,
56131,
1006,
286,
11993,
64,
488,
293,
15752,
286,
7486,
90515,
310,
330,
1703,
756,
310,
330,
16041,
31063,
756,
310,
330,
83997,
16041,
756,
310,
330,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_stdin_skip_1_char() {
new_ucmd!()
.args(&["-s1"]).pipe_in_fixture(SKIP_CHARS)
.run().stdout_is_fixture("skip-1-char.expected");
} | rust_cleaned_test_functions.jsonl/23097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
258,
44830,
62,
16,
9232,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
82,
16,
45014,
13768,
1243,
74409,
72504,
3298,
82319,
340,
286,
659,
6108,
1005,
36358,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cost_model_update_instruction_cost() {
let key1 = Pubkey::new_unique();
let cost1 = 100;
let cost2 = 200;
let updated_cost = (cost1 + cost2) / 2;
let mut cost_model = CostModel::default();
// insert instruction cost to table
assert!(cost_model.upsert_instruction_cost(&key1, cost1).is_ok());
assert_eq!(cost1, cost_model.find_instruction_cost(&key1));
// update instruction cost
assert!(cost_model.upsert_instruction_cost(&key1, cost2).is_ok());
assert_eq!(updated_cost, cost_model.find_instruction_cost(&key1));
} | rust_cleaned_test_functions.jsonl/81995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15890,
5047,
8882,
54923,
15890,
368,
341,
286,
1077,
1376,
16,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
2783,
16,
284,
220,
16,
15,
15,
280,
286,
1077,
2783,
17,
284,
220,
17,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_each() {
let mut handlebars = Registry::new();
assert!(handlebars
.register_template_string(
"t0",
"{{#each this}}{{@first}}|{{@last}}|{{@index}}:{{this}}|{{/each}}"
)
.is_ok());
assert!(handlebars
.register_template_string("t1", "{{#each this}}{{@first}}|{{@key}}:{{this}}|{{/each}}")
.is_ok());
let r0 = handlebars.render("t0", &vec![1u16, 2u16, 3u16]);
assert_eq!(
r0.ok().unwrap(),
"true|false|0:1|false|false|1:2|false|true|2:3|".to_string()
);
let mut m: BTreeMap<String, u16> = BTreeMap::new();
m.insert("ftp".to_string(), 21);
m.insert("http".to_string(), 80);
let r1 = handlebars.render("t1", &m);
assert_eq!(r1.ok().unwrap(), "true|ftp:21|false|http:80|".to_string());
} | rust_cleaned_test_functions.jsonl/127932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 496
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32046,
368,
341,
286,
1077,
5206,
3705,
24950,
284,
32112,
486,
931,
543,
286,
2060,
10297,
8192,
24950,
198,
310,
659,
6343,
8693,
3904,
1006,
394,
330,
83,
15,
756,
394,
47219,
2,
9547,
419,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unknown_protection() {
let bss = fake_bss!(Wpa2,
ies_overrides: IesOverrides::new()
.set(IeType::RSNE, fake_unknown_rsne()[2..].to_vec())
);
assert_eq!(Protection::Unknown, bss.protection());
let bss = fake_bss!(Wpa2,
ies_overrides: IesOverrides::new()
.set(IeType::RSNE, invalid_wpa3_rsne()[2..].to_vec())
);
assert_eq!(Protection::Unknown, bss.protection());
let bss = fake_bss!(Wpa2,
ies_overrides: IesOverrides::new()
.set(IeType::RSNE, invalid_wpa3_enterprise_192_bit_rsne()[2..].to_vec())
);
assert_eq!(Protection::Unknown, bss.protection());
} | rust_cleaned_test_functions.jsonl/60262 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
2540,
39141,
368,
341,
286,
1077,
293,
778,
284,
12418,
880,
778,
10297,
54,
6595,
17,
345,
310,
220,
550,
15431,
18245,
25,
358,
288,
80010,
486,
931,
741,
394,
659,
746,
8972,
68,
929... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sqrt() {
// a = 1488924004771393321054797166853618474668089414631333405711627789629391903630694737978065425271543178763948256226639*u + 784063022264861764559335808165825052288770346101304131934508881646553551234697082295473567906267937225174620141295
let a = Fp2 {
c0: Fp::from_raw_unchecked([
0x2beed14627d7f9e9,
0xb6614e06660e5dce,
0x6c4cc7c2f91d42c,
0x996d78474b7a63cc,
0xebaebc4c820d574e,
0x18865e12d93fd845,
]),
c1: Fp::from_raw_unchecked([
0x7d828664baf4f566,
0xd17e663996ec7339,
0x679ead55cb4078d0,
0xfe3b2260e001ec28,
0x305993d043d91b68,
0x626f03c0489b72d,
]),
};
assert_eq!(a.sqrt().unwrap().square(), a);
// multiplicative subgroup
let b = Fp2 {
c0: Fp::from_raw_unchecked([
0x6631000000105545,
0x211400400eec000d,
0x3fa7af30c820e316,
0xc52a8b8d6387695d,
0x9fb4e61d1e83eac5,
0x5cb922afe84dc7,
]),
c1: Fp::zero(),
};
assert_eq!(b.sqrt().unwrap().square(), b);
// multiplicative subgroup
let c = Fp2 {
c0: Fp::from_raw_unchecked([
0x44f600000051ffae,
0x86b8014199480043,
0xd7159952f1f3794a,
0x755d6e3dfe1ffc12,
0xd36cd6db5547e905,
0x2f8c8ecbf1867bb,
]),
c1: Fp::zero(),
};
assert_eq!(c.sqrt().unwrap().square(), c);
// 2155129644831861015726826462986972654175647013268275306775721078997042729172900466542651176384766902407257452753362*u + 2796889544896299244102912275102369318775038861758288697415827248356648685135290329705805931514906495247464901062529
// is nonsquare.
assert!(bool::from(
Fp2 {
c0: Fp::from_raw_unchecked([
0xc5fa1bc8fd00d7f6,
0x3830ca454606003b,
0x2b287f1104b102da,
0xa7fb30f28230f23e,
0x339cdb9ee953dbf0,
0xd78ec51d989fc57
]),
c1: Fp::from_raw_unchecked([
0x27ec4898cf87f613,
0x9de1394e1abb05a5,
0x947f85dc170fc14,
0x586fbc696b6114b7,
0x2b3475a4077d7169,
0x13e1c895cc4b6c22
])
}
.sqrt()
.is_none()
));
} | rust_cleaned_test_functions.jsonl/97992 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1888
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92199,
368,
341,
286,
442,
264,
284,
220,
16,
19,
23,
23,
24,
17,
19,
15,
15,
19,
22,
22,
16,
18,
24,
18,
18,
17,
16,
15,
20,
19,
22,
24,
22,
16,
21,
21,
23,
20,
18,
21,
16,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_armcap_static_matches_armcap_dynamic() {
assert_eq!(ARMCAP_STATIC, 1 | 4 | 16 | 32);
assert_eq!(ARMCAP_STATIC, unsafe { OPENSSL_armcap_P });
} | rust_cleaned_test_functions.jsonl/50463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34680,
11346,
25360,
38344,
34680,
11346,
45992,
368,
341,
262,
2060,
10714,
10297,
934,
11604,
2537,
31352,
11,
220,
16,
760,
220,
19,
760,
220,
16,
21,
760,
220,
18,
17,
317,
262,
2060,
10714,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_install_target_new_file() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "test_install_target_new_filer_file_j";
let dir = "test_install_target_new_file_dir_j";
at.touch(file);
at.mkdir(dir);
ucmd.arg(file)
.arg(format!("{}/{}", dir, file))
.succeeds()
.no_stderr();
assert!(at.file_exists(file));
assert!(at.file_exists(&format!("{}/{}", dir, file)));
} | rust_cleaned_test_functions.jsonl/124414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34245,
11123,
5921,
2458,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
284,
330,
1944,
34245,
11123,
5921,
761,
5769,
2458,
5374,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec_list_insert_before() {
let mut list = VecList::new();
let index_1 = list.push_back(0);
let index_2 = list.insert_before(index_1, 1);
assert_eq!(list.front(), Some(&1));
assert_eq!(list.get_previous_index(index_1), Some(index_2));
assert_eq!(list.get_next_index(index_2), Some(index_1));
let index_3 = list.insert_before(index_1, 2);
assert_eq!(list.get_previous_index(index_1), Some(index_3));
assert_eq!(list.get_next_index(index_3), Some(index_1));
assert_eq!(list.get_next_index(index_2), Some(index_3));
} | rust_cleaned_test_functions.jsonl/11534 | {
"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,
13251,
2019,
17678,
23708,
368,
341,
286,
1077,
5206,
1140,
284,
11312,
852,
486,
931,
543,
286,
1077,
1922,
62,
16,
284,
1140,
2552,
3895,
7,
15,
317,
286,
1077,
1922,
62,
17,
284,
1140,
7030... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rotation_between_vectors() {
let vector1: Vector2<f64> = 17_f64 * Vector2::unit_x();
let vector2: Vector2<f64> = 3_f64 * Vector2::unit_y();
let isometry = Isometry2::rotation_between(&vector1, &vector2);
let point = Point2::new(203_f64, 0_f64);
let expected = Point2::new(0_f64, 203_f64);
let result = isometry.transform_point(&point);
assert_relative_eq!(result, expected, epsilon = 1e-8);
} | rust_cleaned_test_functions.jsonl/77215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44813,
48302,
49158,
368,
341,
286,
1077,
4621,
16,
25,
4196,
17,
63895,
21,
19,
29,
284,
220,
16,
22,
761,
21,
19,
353,
4196,
17,
486,
3843,
3212,
543,
286,
1077,
4621,
17,
25,
4196,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_attribute_strx1() {
let buf = [0x01, 0x99, 0x99];
let unit = test_parse_attribute_unit(4, Format::Dwarf64, LittleEndian);
let form = constants::DW_FORM_strx1;
let value = AttributeValue::DebugStrOffsetsIndex(DebugStrOffsetsIndex(0x01));
test_parse_attribute(&buf, 1, &unit, form, value);
} | rust_cleaned_test_functions.jsonl/102050 | {
"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,
21039,
16791,
2895,
87,
16,
368,
341,
286,
1077,
6607,
284,
508,
15,
87,
15,
16,
11,
220,
15,
87,
24,
24,
11,
220,
15,
87,
24,
24,
935,
286,
1077,
4982,
284,
1273,
21039,
16791,
14832,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transitions_select() {
let mut vm: VimMachine<KeyEvent> = VimMachine::default();
let mut ctx = VimContext::default();
ctx.persist.shape = Some(TargetShape::CharWise);
vm.input_key(key!('g'));
vm.input_key(key!('h'));
assert_pop2!(vm, CURRENT_POS, ctx);
assert_eq!(vm.mode(), VimMode::Select);
// Select text using the Right arrow key.
let mov = mv!(MoveType::Column(MoveDir1D::Next, false));
vm.input_key(key!(KeyCode::Right));
assert_pop2!(vm, mov, ctx);
assert_eq!(vm.mode(), VimMode::Select);
// Enter a single Visual mode command by using ^O.
vm.input_key(ctl!('o'));
assert_eq!(vm.pop(), None);
assert_eq!(vm.mode(), VimMode::Select);
let mov = mv!(MoveType::Column(MoveDir1D::Next, false));
vm.input_key(key!('l'));
assert_pop2!(vm, mov, ctx);
assert_eq!(vm.mode(), VimMode::Select);
let mov = mv!(MoveType::WordBegin(WordStyle::Little, MoveDir1D::Next));
vm.input_key(key!(KeyCode::Right, KeyModifiers::SHIFT));
assert_pop2!(vm, mov, ctx);
assert_eq!(vm.mode(), VimMode::Select);
ctx.persist.insert = Some(InsertStyle::Insert);
vm.input_key(key!('H'));
assert_pop1!(vm, Action::Edit(EditAction::Delete.into(), EditTarget::Selection), ctx);
assert_pop1!(vm, Action::Type(Char::Single('H').into()), ctx);
ctx.persist.shape = None;
assert_pop2!(vm, CURRENT_POS, ctx);
assert_eq!(vm.mode(), VimMode::Insert);
vm.input_key(key!('l'));
assert_pop2!(vm, Action::Type(Char::Single('l').into()), ctx);
assert_eq!(vm.mode(), VimMode::Insert);
// Back to Normal mode.
ctx.persist.insert = None;
vm.input_key(ctl!('c'));
assert_pop1!(vm, CURSOR_CLOSE, ctx);
assert_pop2!(vm, COLUMN_PREV, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
ctx.persist.shape = Some(TargetShape::BlockWise);
vm.input_key(key!('g'));
vm.input_key(ctl!('h'));
assert_pop2!(vm, CURRENT_POS, ctx);
assert_eq!(vm.mode(), VimMode::Select);
let mov = mv!(MoveType::Line(MoveDir1D::Next));
vm.input_key(key!(KeyCode::Down));
assert_pop2!(vm, mov, ctx);
assert_eq!(vm.mode(), VimMode::Select);
// Using ^O to repeat g^H goes back to Normal mode.
ctx.persist.shape = None;
vm.input_key(ctl!('o'));
assert_eq!(vm.pop(), None);
assert_eq!(vm.mode(), VimMode::Select);
vm.input_key(key!('g'));
assert_eq!(vm.pop(), None);
assert_eq!(vm.mode(), VimMode::Select);
vm.input_key(ctl!('h'));
assert_pop1!(vm, CURSOR_CLOSE, ctx);
assert_pop2!(vm, CURRENT_POS, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
} | rust_cleaned_test_functions.jsonl/74568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
5930,
13051,
368,
341,
286,
1077,
5206,
10995,
25,
94484,
21605,
42003,
1556,
29,
284,
94484,
21605,
486,
2258,
543,
286,
1077,
5206,
5635,
284,
94484,
1972,
486,
2258,
1428,
1789,
286,
5635... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_cache() {
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(2);
let bank = Bank::new(&genesis_config);
let cache = LeaderScheduleCache::new_from_bank(&bank);
assert_eq!(bank.slot(), 0);
assert_eq!(cache.max_schedules(), MAX_SCHEDULES);
// Epoch schedule for all epochs in the range:
// be calculated by constructor
let epoch_schedule = bank.epoch_schedule();
let leader_schedule_epoch = bank.get_leader_schedule_epoch(bank.slot());
for epoch in 0..=leader_schedule_epoch {
let first_slot_in_leader_schedule_epoch = epoch_schedule.get_first_slot_in_epoch(epoch);
let last_slot_in_leader_schedule_epoch = epoch_schedule.get_last_slot_in_epoch(epoch);
assert!(cache
.slot_leader_at(first_slot_in_leader_schedule_epoch, None)
.is_some());
assert!(cache
.slot_leader_at(last_slot_in_leader_schedule_epoch, None)
.is_some());
if epoch == leader_schedule_epoch {
assert!(cache
.slot_leader_at(last_slot_in_leader_schedule_epoch + 1, None)
.is_none());
}
}
// Should be a schedule for every epoch just checked
assert_eq!(
cache.cached_schedules.read().unwrap().0.len() as u64,
leader_schedule_epoch + 1
);
} | rust_cleaned_test_functions.jsonl/26067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 738
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
11529,
368,
341,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
17,
317,
286,
1077,
6073,
284,
8547,
486,
931,
2099,
77894,
5332,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse() {
let cases = &[
(
"rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)",
Version {
minor: 0,
patch: 0,
channel: Stable,
},
),
(
"rustc 1.18.0",
Version {
minor: 18,
patch: 0,
channel: Stable,
},
),
(
"rustc 1.24.1 (d3ae9a9e0 2018-02-27)",
Version {
minor: 24,
patch: 1,
channel: Stable,
},
),
(
"rustc 1.35.0-beta.3 (c13114dc8 2019-04-27)",
Version {
minor: 35,
patch: 0,
channel: Beta,
},
),
(
"rustc 1.36.0-nightly (938d4ffe1 2019-04-27)",
Version {
minor: 36,
patch: 0,
channel: Nightly(Date {
year: 2019,
month: 4,
day: 27,
}),
},
),
(
"rustc 1.36.0-dev",
Version {
minor: 36,
patch: 0,
channel: Dev,
},
),
(
"rustc 1.40.0 (73528e339 2019-12-16)
binary: rustc
commit-hash: 73528e339aae0f17a15ffa49a8ac608f50c6cf14
commit-date: 2019-12-16
host: x86_64-unknown-linux-gnu
release: 1.40.0
LLVM version: 9.0",
Version {
minor: 40,
patch: 0,
channel: Stable,
},
),
(
"rustc 1.36.0-nightly",
Version {
minor: 36,
patch: 0,
channel: Dev,
},
),
(
"warning: invalid logging spec 'warning', ignoring it
rustc 1.30.0-nightly (3bc2ca7e4 2018-09-20)",
Version {
minor: 30,
patch: 0,
channel: Nightly(Date {
year: 2018,
month: 9,
day: 20,
}),
},
),
];
for (string, expected) in cases {
assert_eq!(
parse(string).as_ref(),
Some(expected),
"string {} expected {:#?}",
string,
expected
);
}
} | rust_cleaned_test_functions.jsonl/66869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
262,
1077,
5048,
284,
609,
9640,
286,
2399,
310,
330,
35788,
66,
220,
16,
13,
15,
13,
15,
320,
64,
20,
24,
450,
18,
22,
68,
24,
220,
17,
15,
16,
20,
12,
15,
20,
12,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_bytes_wide_r_squared() {
assert_eq!(
r_squared(),
Scalar::from_bytes_wide(&[
243, 255, 255, 255, 255, 127, 28, 125, 242, 255, 255, 111, 15, 245, 87, 114, 238, 15,
44, 81, 117, 21, 216, 22, 157, 154, 187, 43, 50, 218, 75, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
])
);
} | rust_cleaned_test_functions.jsonl/108344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
12524,
1670,
577,
1710,
54641,
368,
341,
262,
2060,
10714,
33673,
286,
435,
54641,
3148,
286,
35176,
486,
1499,
12524,
1670,
577,
2099,
9640,
310,
220,
17,
19,
18,
11,
220,
17,
20,
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... | 1 |
#[test]
fn test_set_options() {
// This line will fail to provide an initialized FD if the test is not run as root.
let tap = Tap::open_named("").unwrap();
tap.set_vnet_hdr_size(16).unwrap();
tap.set_offload(0).unwrap();
let faulty_tap = Tap {
tap_file: unsafe { File::from_raw_fd(-1) },
if_name: [0x01; 16],
};
assert!(faulty_tap.set_vnet_hdr_size(16).is_err());
assert!(faulty_tap.set_offload(0).is_err());
} | rust_cleaned_test_functions.jsonl/8901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
8743,
368,
341,
286,
442,
1096,
1555,
686,
3690,
311,
3410,
458,
17271,
35318,
421,
279,
1273,
374,
537,
1598,
438,
3704,
624,
286,
1077,
15239,
284,
36134,
486,
2508,
71834,
80821,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_java_version_redhat() {
let java_8 = String::from("OpenJDK 64-Bit Server VM (25.222-b10) for linux-amd64 JRE (1.8.0_222-b10), built on Jul 11 2019 20:48:53 by \"root\" with gcc 7.3.1 20180303 (Red Hat 7.3.1-5)");
let java_12 = String::from("OpenJDK 64-Bit Server VM (12.0.2+10) for linux-amd64 JRE (12.0.2+10), built on Jul 18 2019 14:41:47 by \"jenkins\" with gcc 7.3.1 20180303 (Red Hat 7.3.1-5)");
assert_eq!(format_java_version(java_8), Some(String::from("v1.8.0")));
assert_eq!(format_java_version(java_12), Some(String::from("v12.0.2")));
} | rust_cleaned_test_functions.jsonl/104943 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
77323,
9438,
26058,
9198,
368,
341,
286,
1077,
1642,
62,
23,
284,
923,
486,
1499,
445,
5002,
41,
18301,
220,
21,
19,
7671,
275,
8422,
17792,
320,
17,
20,
13,
17,
17,
17,
1455,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_imix_model() {
let model = PacketModels::try_from(ModelConfig::Imix(ImixModelConfig {
bandwidth: 12_252_000,
}))
.unwrap();
for seq in 0..IMIX_SAMPLE_COUNT {
let pkt = model.get_packet(seq);
let expected = Packet {
seq,
size: IMIX_SAMPLE[seq % IMIX_SAMPLE_COUNT],
next_ns: 233_648,
};
assert_eq!(pkt, expected);
}
} | rust_cleaned_test_functions.jsonl/25231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17895,
941,
5047,
368,
341,
286,
1077,
1614,
284,
28889,
16969,
486,
1539,
5673,
26442,
2648,
486,
1427,
941,
7,
1427,
941,
1712,
2648,
341,
310,
33394,
25,
220,
16,
17,
62,
17,
20,
17,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_str_sm3() {
let hash = HashImpl::from_str("sm3").unwrap();
let data = [1u8, 2u8, 3u8];
let mut out = [0u8; 32];
hash.hash(&mut out, &data);
assert_eq!(
out,
[
158, 139, 109, 83, 238, 96, 25, 26, 219, 93, 71, 130, 155, 7, 70, 50, 56, 171, 15, 159,
227, 157, 222, 97, 216, 238, 73, 54, 50, 158, 49, 251
]
);
} | rust_cleaned_test_functions.jsonl/14946 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
15874,
18,
368,
341,
10217,
5175,
284,
6531,
9673,
486,
1499,
2895,
445,
3563,
18,
1827,
15454,
543,
10217,
821,
284,
508,
16,
84,
23,
11,
220,
17,
84,
23,
11,
220,
18,
84,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normalized_authority() {
fn local(input: &str, default_namespace: &str) -> String {
use bytes::Bytes;
use http::uri::Authority;
let input = Authority::from_shared(Bytes::from(input.as_bytes()))
.unwrap();
let output = super::FullyQualifiedAuthority::normalize(
&input, default_namespace);
assert_eq!(output.use_destination_service, true, "input: {}", input);
output.name.without_trailing_dot().as_str().into()
}
fn external(input: &str, default_namespace: &str) {
use bytes::Bytes;
use http::uri::Authority;
let input = Authority::from_shared(Bytes::from(input.as_bytes())).unwrap();
let output = super::FullyQualifiedAuthority::normalize(
&input, default_namespace);
assert_eq!(output.use_destination_service, false);
assert_eq!(output.name.without_trailing_dot().as_str(), input);
}
assert_eq!("name.namespace.svc.cluster.local", local("name", "namespace"));
assert_eq!("name.namespace.svc.cluster.local", local("name.namespace", "namespace"));
assert_eq!("name.namespace.svc.cluster.local",
local("name.namespace.svc", "namespace"));
external("name.namespace.svc.cluster", "namespace");
assert_eq!("name.namespace.svc.cluster.local",
local("name.namespace.svc.cluster.local", "namespace"));
// Fully-qualified names end with a dot and aren't modified except by removing the dot.
external("name.", "namespace");
external("name.namespace.", "namespace");
external("name.namespace.svc.", "namespace");
external("name.namespace.svc.cluster.", "namespace");
external("name.namespace.svc.acluster.local.", "namespace");
assert_eq!("name.namespace.svc.cluster.local",
local("name.namespace.svc.cluster.local.", "namespace"));
// Name resolution APIs and libraries SHOULD recognize localhost
// names as special and SHOULD always return the IP loopback address
external("localhost.", "namespace");
external("name.localhost.", "namespace");
external("name.namespace.svc.localhost.", "namespace");
// standard behavior for non-absolute "localhost" and names that end with
// ".localhost" at least until we're comfortable implementing
assert_eq!("localhost.namespace.svc.cluster.local",
local("localhost", "namespace"));
assert_eq!("name.localhost.svc.cluster.local",
local("name.localhost", "namespace"));
// Ports are preserved.
assert_eq!("name.namespace.svc.cluster.local:1234",
local("name:1234", "namespace"));
assert_eq!("name.namespace.svc.cluster.local:1234",
local("name.namespace:1234", "namespace"));
assert_eq!("name.namespace.svc.cluster.local:1234",
local("name.namespace.svc:1234", "namespace"));
external("name.namespace.svc.cluster:1234", "namespace");
assert_eq!("name.namespace.svc.cluster.local:1234",
local("name.namespace.svc.cluster.local:1234", "namespace"));
// "SVC" is recognized as being equivalent to "svc"
assert_eq!("name.namespace.SVC.cluster.local",
local("name.namespace.SVC", "namespace"));
external("name.namespace.SVC.cluster", "namespace");
assert_eq!("name.namespace.SVC.cluster.local",
local("name.namespace.SVC.cluster.local", "namespace"));
// IPv4 addresses are left unchanged.
external("1.2.3.4", "namespace");
external("1.2.3.4:1234", "namespace");
external("127.0.0.1", "namespace");
external("127.0.0.1:8080", "namespace");
// IPv6 addresses are left unchanged.
external("[::1]", "namespace");
external("[::1]:1234", "namespace");
} | rust_cleaned_test_functions.jsonl/69370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1904
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80006,
22938,
487,
368,
341,
286,
5168,
2205,
5384,
25,
609,
495,
11,
1638,
41571,
25,
609,
495,
8,
1464,
923,
341,
310,
990,
5820,
486,
7078,
280,
310,
990,
1758,
486,
6070,
486,
45532,
401,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_incorrect_network_id() {
let tx = TxSimple::new_with_signature(&PublicKey::zero(), "My little pony", &Signature::zero());
let mut vec = tx.as_ref().as_ref().to_vec();
vec[0] = 128;
let _msg = TxSimple::from_raw(RawMessage::from_vec(vec)).unwrap();
} | rust_cleaned_test_functions.jsonl/90747 | {
"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,
1243,
19928,
20966,
842,
368,
341,
262,
1077,
9854,
284,
39850,
16374,
486,
931,
6615,
39859,
2099,
61822,
486,
14154,
1507,
330,
5050,
2632,
52636,
497,
609,
25088,
486,
14154,
1423,
262,
1077,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_median() {
let median = |x: Weibull| x.median();
test_case(1.0, 0.1, 0.069314718055994530941723212145817656807550013436026, median);
test_case(1.0, 1.0, 0.69314718055994530941723212145817656807550013436026, median);
test_case(10.0, 10.0, 9.6401223546778973665856033763604752124634905617583, median);
test_case(10.0, 1.0, 0.96401223546778973665856033763604752124634905617583, median);
} | rust_cleaned_test_functions.jsonl/122499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83003,
368,
341,
286,
1077,
22553,
284,
760,
87,
25,
1205,
579,
617,
91,
856,
81796,
543,
286,
1273,
19096,
7,
16,
13,
15,
11,
220,
15,
13,
16,
11,
220,
15,
13,
15,
21,
24,
18,
16,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not() {
let mut schemaReplicant = SchemaReplicant::default();
associate_causetId(&mut schemaReplicant, Keyword::namespaced("page", "url"), 97);
associate_causetId(&mut schemaReplicant, Keyword::namespaced("page", "title"), 98);
associate_causetId(&mut schemaReplicant, Keyword::namespaced("page", "bookmarked"), 99);
for x in 97..99 {
add_attribute(&mut schemaReplicant, x, Attribute {
value_type: MinkowskiValueType::String,
..Default::default()
});
}
add_attribute(&mut schemaReplicant, 99, Attribute {
value_type: MinkowskiValueType::Boolean,
..Default::default()
});
let causetq = r#"[:find ?title
:where [?page :page/title ?title]
(not [?page :page/url "http://foo.com/"]
[?page :page/bookmarked true])]"#;
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq);
assert_eq!(allegrosql, "SELECT DISTINCT `Causets00`.v AS `?title` FROM `causets` AS `Causets00` WHERE `Causets00`.a = 98 AND NOT EXISTS (SELECT 1 FROM `causets` AS `Causets01`, `causets` AS `Causets02` WHERE `Causets01`.a = 97 AND `Causets01`.v = $v0 AND `Causets02`.a = 99 AND `Causets02`.v = 1 AND `Causets00`.e = `Causets01`.e AND `Causets00`.e = `Causets02`.e)");
assert_eq!(args, vec![make_arg("$v0", "http://foo.com/")]);
} | rust_cleaned_test_functions.jsonl/90714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 638
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
368,
341,
262,
1077,
5206,
10802,
18327,
35237,
284,
12539,
18327,
35237,
486,
2258,
543,
262,
21946,
666,
11855,
295,
764,
2099,
6984,
10802,
18327,
35237,
11,
48970,
486,
11400,
68552,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_raw_node_start() {
setup_for_test();
let store = new_storage();
let mut raw_node = new_raw_node(1, vec![1], 10, 1, store.clone());
let rd = raw_node.ready();
must_cmp_ready(&rd, &None, &None, &[], vec![], false);
store.wl().append(rd.entries()).unwrap();
raw_node.advance(rd);
raw_node.campaign().expect("");
let rd = raw_node.ready();
store.wl().append(rd.entries()).expect("");
raw_node.advance(rd);
raw_node.propose(vec![], b"foo".to_vec()).expect("");
let rd = raw_node.ready();
must_cmp_ready(
&rd,
&None,
&Some(hard_state(2, 3, 1)),
&[new_entry(2, 3, Some("foo"))],
vec![new_entry(2, 3, Some("foo"))],
false,
);
store.wl().append(rd.entries()).expect("");
raw_node.advance(rd);
assert!(!raw_node.has_ready());
} | rust_cleaned_test_functions.jsonl/50338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
5084,
4906,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
3553,
284,
501,
23310,
543,
262,
1077,
5206,
7112,
5084,
284,
501,
16067,
5084,
7,
16,
11,
7486,
20703,
16,
1125,
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_md5hash_function() -> Result<()> {
struct Test {
name: &'static str,
arg: DataColumnWithField,
expect: Result<DataColumn>,
}
let tests = vec![
Test {
name: "valid input",
arg: DataColumnWithField::new(
Series::new([Some("testing")]).into(),
DataField::new("arg1", DataType::String, true),
),
expect: Ok(DataColumn::Constant(
DataValue::String(Some("ae2b1fca515949e5d54fb22b8ed95575".as_bytes().to_vec())),
1,
)),
},
Test {
name: "valid input with null",
arg: DataColumnWithField::new(
Series::new([Some("testing"), None]).into(),
DataField::new("arg1", DataType::String, true),
),
expect: Ok(DataColumn::Array(Series::new(vec![
Some("ae2b1fca515949e5d54fb22b8ed95575".as_bytes().to_vec()),
None,
]))),
},
];
let func = Md5HashFunction::try_create("md5")?;
for t in tests {
let got = func.return_type(&[t.arg.data_type().clone()]);
let got = got.and_then(|_| func.eval(&[t.arg], 1));
match t.expect {
Ok(expected) => {
assert_eq!(&got.unwrap(), &expected, "case: {}", t.name);
}
Err(expected_err) => {
assert_eq!(got.unwrap_err().to_string(), expected_err.to_string());
}
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/123102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 846
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32994,
20,
8296,
9174,
368,
1464,
5714,
71698,
341,
262,
2036,
3393,
341,
286,
829,
25,
30136,
1978,
607,
345,
286,
1392,
25,
72515,
2354,
1877,
345,
286,
1720,
25,
5714,
44395,
2933,
12520,
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... | 4 |
#[test]
fn test_display() {
let mut span = Span::default();
let s = format!("{}", span);
assert!(!s.is_empty());
span.new_column();
let s = format!("{}", span);
assert!(!s.is_empty());
span.new_line();
let s = format!("{}", span);
assert!(!s.is_empty());
} | rust_cleaned_test_functions.jsonl/44737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
368,
341,
286,
1077,
5206,
9390,
284,
11903,
486,
2258,
543,
286,
1077,
274,
284,
3561,
79878,
9390,
317,
286,
2060,
0,
3471,
82,
2079,
15124,
5231,
286,
9390,
4618,
8744,
543,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_learner_election_timeout() {
setup_for_test();
let mut n1 = new_test_learner_raft(1, vec![1], vec![2], 10, 1, new_storage());
n1.become_follower(1, INVALID_ID);
let mut n2 = new_test_learner_raft(2, vec![1], vec![2], 10, 1, new_storage());
n2.become_follower(1, INVALID_ID);
let timeout = n2.get_election_timeout();
n2.set_randomized_election_timeout(timeout);
for _ in 0..timeout {
n2.tick();
}
assert_eq!(n2.state, StateRole::Follower);
} | rust_cleaned_test_functions.jsonl/107178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
93595,
2204,
1170,
20537,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
308,
16,
284,
501,
4452,
62,
93595,
62,
2944,
7,
16,
11,
7486,
20703,
16,
1125,
7486,
20703,
17,
1125,
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_to_v2_blob_url() {
let image = Reference::try_from(HELLO_IMAGE_TAG).expect("failed to parse reference");
let blob_url = Client::default().to_v2_blob_url(
image.registry(),
image.repository(),
"sha256:deadbeef",
);
assert_eq!(
blob_url,
"https://webassembly.azurecr.io/v2/hello-wasm/blobs/sha256:deadbeef"
)
} | rust_cleaned_test_functions.jsonl/109368 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
2273,
17,
45908,
2903,
368,
341,
286,
1077,
2168,
284,
17207,
486,
1539,
5673,
7,
50712,
1593,
19121,
16592,
568,
17119,
445,
16091,
311,
4715,
5785,
797,
286,
1077,
23404,
2903,
284,
8423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make() {
let res = make(OpConstant, vec![65534]);
assert_eq!(res, vec![0, 255, 254]);
} | rust_cleaned_test_functions.jsonl/89578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
368,
341,
286,
1077,
592,
284,
1281,
54494,
15472,
11,
7486,
20703,
21,
20,
20,
18,
19,
2558,
286,
2060,
10714,
10297,
416,
11,
7486,
20703,
15,
11,
220,
17,
20,
20,
11,
220,
17,
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 |
#[test]
fn test_calculate_cell_widths_when_component_has_multiple_rows() {
let mut component = TableComponent::new(KeyConfig::default());
component.headers = vec!["1", "2", "3"].iter().map(|h| h.to_string()).collect();
component.rows = vec![
vec!["aaaaa", "bbbbb", "ccccc"]
.iter()
.map(|h| h.to_string())
.collect(),
vec!["dddddddddd", "e", "f"]
.iter()
.map(|h| h.to_string())
.collect(),
];
let (selected_column_index, headers, rows, constraints) =
component.calculate_cell_widths(20);
assert_eq!(selected_column_index, 1);
assert_eq!(headers, vec!["", "1", "2", "3"]);
assert_eq!(
rows,
vec![
vec!["1", "aaaaa", "bbbbb", "ccccc"],
vec!["2", "dddddddddd", "e", "f"]
]
);
assert_eq!(
constraints,
vec![
Constraint::Length(1),
Constraint::Length(10),
Constraint::Length(5),
Constraint::Length(5),
]
);
} | rust_cleaned_test_functions.jsonl/120827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 703
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
16648,
7927,
82,
47636,
23406,
21778,
45233,
10949,
368,
341,
286,
1077,
5206,
3692,
284,
6633,
2189,
486,
931,
21358,
2648,
486,
2258,
1423,
286,
3692,
18022,
284,
7486,
0,
1183,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_default_argon2parameters() {
let mut argon2_parameters_vec: Vec<u8> = vec![0u8; GetDefaultArgon2ParametersSize() as usize];
let argon2_parameters_raw = argon2_parameters_vec.as_mut_ptr();
unsafe {
let result = GetDefaultArgon2Parameters(
argon2_parameters_raw,
GetDefaultArgon2ParametersSize() as usize,
);
assert_eq!(result, 0);
}
unsafe {
let argon2_parameters = slice::from_raw_parts(
argon2_parameters_raw,
GetDefaultArgon2ParametersSize() as usize,
);
let _params = Argon2Parameters::try_from(argon2_parameters).unwrap();
let defaults: Vec<u8> = Argon2Parameters::default().into();
let received: Vec<u8> = argon2_parameters.to_vec();
assert_eq!(
defaults[..defaults.len() - 16],
received[..received.len() - 16]
);
}
} | rust_cleaned_test_functions.jsonl/50064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9993,
6057,
263,
17,
13786,
368,
341,
262,
1077,
5206,
1392,
263,
17,
18263,
13251,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
84,
23,
26,
2126,
3675,
2735,
263,
17,
9706,
1695,
368... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_char_err() {
Python::with_gil(|py| {
let s = "Hello Python";
let py_string = s.to_object(py);
let err: crate::PyResult<char> = FromPyObject::extract(py_string.as_ref(py));
assert!(err
.unwrap_err()
.to_string()
.contains("expected a string of length 1"));
})
} | rust_cleaned_test_functions.jsonl/118015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
9232,
9266,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
274,
284,
330,
9707,
13027,
876,
310,
1077,
4510,
3904,
284,
274,
2389,
5314,
46827,
317,
310,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_escape_debug() {
fn string(c: char) -> String {
let iter: String = c.escape_debug().collect();
let disp: String = c.escape_debug().to_string();
assert_eq!(iter, disp);
iter
}
assert_eq!(string('\n'), "\\n");
assert_eq!(string('\r'), "\\r");
assert_eq!(string('\''), "\\'");
assert_eq!(string('"'), "\\\"");
assert_eq!(string(' '), " ");
assert_eq!(string('a'), "a");
assert_eq!(string('~'), "~");
assert_eq!(string('é'), "é");
assert_eq!(string('文'), "文");
assert_eq!(string('\x00'), "\\u{0}");
assert_eq!(string('\x1f'), "\\u{1f}");
assert_eq!(string('\x7f'), "\\u{7f}");
assert_eq!(string('\u{80}'), "\\u{80}");
assert_eq!(string('\u{ff}'), "\u{ff}");
assert_eq!(string('\u{11b}'), "\u{11b}");
assert_eq!(string('\u{1d4b6}'), "\u{1d4b6}");
assert_eq!(string('\u{200b}'),"\\u{200b}"); // zero width space
assert_eq!(string('\u{e000}'), "\\u{e000}"); // private use 1
assert_eq!(string('\u{100000}'), "\\u{100000}"); // private use 2
} | rust_cleaned_test_functions.jsonl/109586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 535
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21832,
15446,
368,
341,
262,
5168,
914,
1337,
25,
1161,
8,
1464,
923,
341,
286,
1077,
5367,
25,
923,
284,
272,
57081,
15446,
1005,
17384,
543,
286,
1077,
12965,
25,
923,
284,
272,
57081,
15446,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_external_call() -> TestResult {
let p = polar();
p.register_constant(sym!("Foo"), term!(true))?;
let mut foo_lookups = vec![term!(1)];
let q = p.new_query("(new Foo()).bar(1, a: 2, b: 3) = 1", false)?;
let mock_foo_lookup =
|_, _, _, args: Option<Vec<Term>>, kwargs: Option<BTreeMap<Symbol, Term>>| {
assert_eq!(args.unwrap()[0], term!(1));
assert_eq!(
kwargs.unwrap(),
btreemap! {sym!("a") => term!(2), sym!("b") => term!(3)}
);
foo_lookups.pop()
};
let results = query_results!(q, mock_foo_lookup);
assert_eq!(results.len(), 1);
assert!(foo_lookups.is_empty());
Ok(())
} | rust_cleaned_test_functions.jsonl/68120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47432,
13429,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
543,
262,
281,
9929,
34967,
62512,
17223,
40923,
3975,
4647,
10297,
1866,
593,
37445,
262,
1077,
5206,
15229,
24271,
8602,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_double_statistics_nan_only() {
let stats = statistics_roundtrip::<DoubleType>(&[f64::NAN, f64::NAN]);
assert!(!stats.has_min_max_set());
assert!(matches!(stats, Statistics::Double(_)));
} | rust_cleaned_test_functions.jsonl/54374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
49569,
73936,
18410,
368,
341,
286,
1077,
10472,
284,
13142,
29896,
32981,
27638,
7378,
929,
44784,
58,
69,
21,
19,
486,
45,
1093,
11,
282,
21,
19,
486,
45,
1093,
2558,
286,
2060,
0,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_call_empty_data() {
let test_addr = Address::default();
let host = get_dummy_host_interface();
let host_context = std::ptr::null_mut();
let mut exe_context = ExecutionContext::new(&host, host_context);
let message = ExecutionMessage::new(
MessageKind::EVMC_CALL,
0,
0,
6566,
test_addr,
test_addr,
None,
Uint256::default(),
Bytes32::default(),
);
let b = exe_context.call(&message);
assert_eq!(b.status_code(), StatusCode::EVMC_SUCCESS);
assert_eq!(b.gas_left(), 2);
assert!(b.output().is_none());
assert!(b.create_address().is_some());
assert_eq!(b.create_address().unwrap(), &Address::default());
} | rust_cleaned_test_functions.jsonl/100732 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
15124,
1769,
368,
341,
1789,
286,
1077,
1273,
7387,
284,
9177,
486,
2258,
543,
286,
1077,
3468,
284,
633,
60321,
12848,
20546,
543,
286,
1077,
3468,
8467,
284,
1460,
486,
3505,
486,
2921,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cpuid() {
let mini_plugin = MiniPlugin {
assembly_src: "org 0x1000
bits 16
push eax
push ecx
cpuid
mov [0x0], eax
mov [0x4], ebx
mov [0x8], ecx
mov [0xc], edx
pop ecx
pop eax
add ecx, 1
cpuid
mov [0x10], eax
mov [0x14], ebx
mov [0x18], ecx
mov [0x1c], edx
mov byte [es:0], 1",
src: r#"
#define ENTRY1_INDEX 0
#define ENTRY1_EAX 0x40414243
#define ENTRY1_EBX 0x50515253
#define ENTRY1_ECX 0x60616263
#define ENTRY1_EDX 0x71727374
#define ENTRY2_INDEX 1
#define ENTRY2_EAX 0xAABBCCDD
#define ENTRY2_EBX 0xEEFF0011
#define ENTRY2_ECX 0x22334455
#define ENTRY2_EDX 0x66778899
#define KILL_ADDRESS 0x3000
int g_kill_evt;
struct kvm_msr_entry g_msr2;
int setup_vm(struct crosvm *crosvm, void *mem) {
g_kill_evt = crosvm_get_shutdown_eventfd(crosvm);
crosvm_reserve_range(crosvm, CROSVM_ADDRESS_SPACE_MMIO, KILL_ADDRESS, 1);
return 0;
}
int handle_vpcu_init(struct crosvm_vcpu *vcpu, struct kvm_regs *regs,
struct kvm_sregs *sregs)
{
regs->rax = ENTRY1_INDEX;
regs->rcx = 0;
regs->rsp = 0x1000;
sregs->es.base = KILL_ADDRESS;
struct kvm_cpuid_entry2 entries[2];
entries[0].function = 0;
entries[0].index = ENTRY1_INDEX;
entries[0].flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
entries[0].eax = ENTRY1_EAX;
entries[0].ebx = ENTRY1_EBX;
entries[0].ecx = ENTRY1_ECX;
entries[0].edx = ENTRY1_EDX;
entries[1].function = 0;
entries[1].index = ENTRY2_INDEX;
entries[1].flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
entries[1].eax = ENTRY2_EAX;
entries[1].ebx = ENTRY2_EBX;
entries[1].ecx = ENTRY2_ECX;
entries[1].edx = ENTRY2_EDX;
return crosvm_vcpu_set_cpuid(vcpu, 2, entries);
}
int handle_vpcu_evt(struct crosvm_vcpu *vcpu, struct crosvm_vcpu_event evt) {
if (evt.kind == CROSVM_VCPU_EVENT_KIND_IO_ACCESS &&
evt.io_access.address_space == CROSVM_ADDRESS_SPACE_MMIO &&
evt.io_access.address == KILL_ADDRESS &&
evt.io_access.is_write &&
evt.io_access.length == 1 &&
evt.io_access.data[0] == 1)
{
uint64_t dummy = 1;
write(g_kill_evt, &dummy, sizeof(dummy));
return 1;
}
return 0;
}
int check_result(struct crosvm *vcpu, void *memory) {
uint32_t *mem = (uint32_t*)memory;
if (mem[0] != ENTRY1_EAX) {
fprintf(stderr, "entry 1 eax has unexpected value: 0x%x\n", mem[0]);
return 1;
}
if (mem[1] != ENTRY1_EBX) {
fprintf(stderr, "entry 1 ebx has unexpected value: 0x%x\n", mem[1]);
return 1;
}
if (mem[2] != ENTRY1_ECX) {
fprintf(stderr, "entry 1 ecx has unexpected value: 0x%x\n", mem[2]);
return 1;
}
if (mem[3] != ENTRY1_EDX) {
fprintf(stderr, "entry 1 edx has unexpected value: 0x%x\n", mem[3]);
return 1;
}
if (mem[4] != ENTRY2_EAX) {
fprintf(stderr, "entry 2 eax has unexpected value: 0x%x\n", mem[4]);
return 1;
}
if (mem[5] != ENTRY2_EBX) {
fprintf(stderr, "entry 2 ebx has unexpected value: 0x%x\n", mem[5]);
return 1;
}
if (mem[6] != ENTRY2_ECX) {
fprintf(stderr, "entry 2 ecx has unexpected value: 0x%x\n", mem[6]);
return 1;
}
if (mem[7] != ENTRY2_EDX) {
fprintf(stderr, "entry 2 edx has unexpected value: 0x%x\n", mem[7]);
return 1;
}
return 0;
}"#,
..Default::default()
};
test_mini_plugin(&mini_plugin);
} | rust_cleaned_test_functions.jsonl/35304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3066
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39811,
2423,
368,
341,
262,
1077,
13420,
23110,
284,
19643,
11546,
341,
286,
14614,
16274,
25,
330,
1775,
220,
15,
87,
16,
15,
15,
15,
198,
1797,
9472,
220,
16,
21,
198,
1797,
4484,
36252,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_real_ignore_private() {
let output = cargo_hack()
.args(&["hack", "check", "--ignore-private"])
.current_dir(test_dir("tests/fixtures/real"))
.output()
.unwrap();
output
.assert_success()
.assert_stderr_not_contains("running `cargo check` on member1")
.assert_stderr_not_contains("skipped running on member1")
.assert_stderr_not_contains("running `cargo check` on member2")
.assert_stderr_not_contains("skipped running on member2")
.assert_stderr_not_contains("running `cargo check` on real")
.assert_stderr_contains("skipped running on real");
let output = cargo_hack()
.args(&["hack", "check", "--all", "--ignore-private"])
.current_dir(test_dir("tests/fixtures/real"))
.output()
.unwrap();
output
.assert_success()
.assert_stderr_contains("running `cargo check` on member1")
.assert_stderr_not_contains("skipped running on member1")
.assert_stderr_not_contains("running `cargo check` on member2")
.assert_stderr_contains("skipped running on member2")
.assert_stderr_contains("running `cargo check` on member3")
.assert_stderr_not_contains("skipped running on member3")
.assert_stderr_not_contains("running `cargo check` on real")
.assert_stderr_contains("skipped running on real");
} | rust_cleaned_test_functions.jsonl/25295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 612
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
58493,
26249,
368,
341,
262,
1077,
2550,
284,
25652,
1523,
473,
741,
286,
659,
2116,
2099,
1183,
65972,
497,
330,
2028,
497,
14482,
13130,
65277,
14108,
286,
659,
3231,
4334,
8623,
4334,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_null_bits() {
let mut mut_buf = MutableBuffer::new(64).with_bitset(64, true);
mut_buf.set_null_bits(0, 64);
let buf = mut_buf.freeze();
assert_eq!(0, bit_util::count_set_bits(buf.data()));
let mut mut_buf = MutableBuffer::new(64).with_bitset(64, true);
mut_buf.set_null_bits(32, 32);
let buf = mut_buf.freeze();
assert_eq!(256, bit_util::count_set_bits(buf.data()));
} | rust_cleaned_test_functions.jsonl/20567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
15162,
20034,
368,
341,
286,
1077,
5206,
5206,
10363,
284,
31143,
4095,
486,
931,
7,
21,
19,
568,
4197,
13996,
746,
7,
21,
19,
11,
830,
317,
286,
5206,
10363,
980,
15162,
20034,
7,
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_canonical_list_encoding() {
assert_ne!(
Rlp::new(&[0xc0 + 3, 0x82, b'a', b'b']).val_at::<String>(0),
Rlp::new(&[0xf7 + 1, 3, 0x82, b'a', b'b']).val_at::<String>(0)
);
assert_eq!(
Rlp::new(&[0xf7 + 1, 3, 0x82, b'a', b'b']).val_at::<String>(0),
Err(DecoderError::RlpInvalidIndirection)
);
} | rust_cleaned_test_functions.jsonl/74214 | {
"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,
27421,
22391,
2019,
37613,
368,
341,
6948,
13925,
33673,
197,
11143,
13545,
486,
931,
2099,
58,
15,
8148,
15,
488,
220,
18,
11,
220,
15,
87,
23,
17,
11,
293,
25184,
516,
293,
90853,
25049,
831... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pipe_from_handle() {
let kern = Kernel::new_for_testing();
let (left_handle, right_handle) =
zx::Socket::create(zx::SocketOpts::STREAM).expect("failed to create socket");
create_file_from_handle(&kern, left_handle.into_handle())
.expect("failed to create left FileHandle");
create_file_from_handle(&kern, right_handle.into_handle())
.expect("failed to create right FileHandle");
} | rust_cleaned_test_functions.jsonl/70294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
41862,
5673,
10630,
368,
341,
286,
1077,
82585,
284,
36603,
486,
931,
5478,
70962,
543,
286,
1077,
320,
2359,
10630,
11,
1290,
10630,
8,
4035,
310,
71322,
486,
10286,
486,
3182,
13174,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_upload_file() {
let key = key();
let client = Client::new();
let buffer = read("tests/resources/cat.png");
let res = client.upload_file(&key, buffer).expect("file err");
assert!(res.success);
assert_eq!(res.files[0].name, None);
assert!(res.files[0].size > 1);
} | rust_cleaned_test_functions.jsonl/79498 | {
"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,
21691,
2458,
368,
341,
262,
1077,
1376,
284,
1376,
543,
262,
1077,
2943,
284,
8423,
486,
931,
1428,
262,
1077,
4147,
284,
1349,
445,
23841,
38900,
92807,
3508,
3071,
262,
1077,
592,
284,
2943,
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_interface_kind() {
assert_to_bytes!(InterfaceKind::Type, &[0x00]);
assert_to_bytes!(InterfaceKind::Import, &[0x01]);
assert_to_bytes!(InterfaceKind::Adapter, &[0x02]);
assert_to_bytes!(InterfaceKind::Export, &[0x03]);
assert_to_bytes!(InterfaceKind::Implementation, &[0x04]);
} | rust_cleaned_test_functions.jsonl/132562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20546,
33162,
368,
341,
286,
2060,
2346,
12524,
10297,
5051,
10629,
486,
929,
11,
44590,
15,
87,
15,
15,
2558,
286,
2060,
2346,
12524,
10297,
5051,
10629,
486,
11511,
11,
44590,
15,
87,
15,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_auto() {
assert_eq!(config::validate_auto("off"), Ok(()));
assert_eq!(config::validate_auto("1 day"), Ok(()));
assert_eq!(config::validate_auto("2 weeks 3 days 1 hr"), Ok(()));
assert_eq!(
config::validate_auto("foo").unwrap_err().to_string(),
"Validation error: invalid_duration_string [{}]".to_string()
);
} | rust_cleaned_test_functions.jsonl/79926 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
27740,
368,
341,
286,
2060,
10714,
10297,
1676,
486,
7067,
27740,
445,
1847,
3975,
7622,
5065,
1106,
286,
2060,
10714,
10297,
1676,
486,
7067,
27740,
445,
16,
1899,
3975,
7622,
5065,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ns_struct_pod_request() {
let hdr = indoc! {"
#include <cstdint>
namespace A {
struct Bob {
uint32_t a;
};
}
"};
let rs = quote! {
ffi::A::Bob { a: 12 };
};
run_test("", hdr, rs, &[], &["A::Bob"]);
} | rust_cleaned_test_functions.jsonl/9809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34728,
15126,
85337,
7893,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
96975,
397,
286,
4473,
362,
341,
310,
2036,
14261,
341,
394,
2622,
18,
17,
528,
264,
280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_character_separate() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-c", "1,2,4", "sed", "s/./A/"])
.write_stdin("1234\n")
.assert()
.stdout("A23A\n"); // Not "AA3A"
} | rust_cleaned_test_functions.jsonl/7913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40988,
3453,
67598,
368,
341,
286,
1077,
5206,
5439,
284,
2060,
11684,
486,
4062,
486,
66715,
21816,
16978,
17223,
34,
7581,
46,
94126,
4708,
15197,
15454,
543,
286,
5439,
16365,
2099,
1183,
12,
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_ordered_batched_operations() {
// after commit there is one doc with "a" and 0 doc with "b"
let mut schema_builder = schema::Schema::builder();
let text_field = schema_builder.add_text_field("text", schema::TEXT);
let index = Index::create_in_ram(schema_builder.build());
let reader = index
.reader_builder()
.reload_policy(ReloadPolicy::Manual)
.try_into()
.unwrap();
let mut index_writer = index.writer_for_tests().unwrap();
let a_term = Term::from_field_text(text_field, "a");
let b_term = Term::from_field_text(text_field, "b");
let operations = vec![
UserOperation::Delete(a_term),
UserOperation::Add(doc!(text_field=>"a")),
UserOperation::Add(doc!(text_field=>"b")),
UserOperation::Delete(b_term),
];
index_writer.run(operations).unwrap();
index_writer.commit().expect("failed to commit");
reader.reload().expect("failed to load searchers");
let a_term = Term::from_field_text(text_field, "a");
let b_term = Term::from_field_text(text_field, "b");
let a_query = TermQuery::new(a_term, IndexRecordOption::Basic);
let b_query = TermQuery::new(b_term, IndexRecordOption::Basic);
let searcher = reader.searcher();
let a_docs = searcher
.search(&a_query, &TopDocs::with_limit(1))
.expect("search for a failed");
let b_docs = searcher
.search(&b_query, &TopDocs::with_limit(1))
.expect("search for b failed");
assert_eq!(a_docs.len(), 1);
assert_eq!(b_docs.len(), 0);
} | rust_cleaned_test_functions.jsonl/21495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 822
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75272,
14534,
291,
57345,
368,
341,
16885,
16885,
286,
442,
1283,
5266,
1052,
374,
825,
4629,
448,
330,
64,
1,
323,
220,
15,
4629,
448,
330,
65,
698,
286,
1077,
5206,
10802,
28532,
284,
10802,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_truncate_all_then_undo() {
let mut buf = Buffer::new();
buf.insert(0, &['a', 'b', 'c', 'd', 'e', 'f', 'g']);
buf.truncate(0);
buf.undo();
assert_eq!(String::from(buf), "abcdefg");
} | rust_cleaned_test_functions.jsonl/61888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
26900,
5705,
68367,
98940,
368,
341,
286,
1077,
5206,
6607,
284,
10312,
486,
931,
543,
286,
6607,
7030,
7,
15,
11,
609,
677,
64,
516,
364,
65,
516,
364,
66,
516,
364,
67,
516,
364,
68,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_capacity_constant_time() {
use std::time::Instant;
// trigger function invoking optimize once
MerkleTree::calculate_vec_capacity(2);
// record time spending
let mut time_record = Instant::now();
MerkleTree::calculate_vec_capacity(4);
let small_leaf_count_duration = time_record.elapsed();
time_record = Instant::now();
MerkleTree::calculate_vec_capacity(65536);
let large_leaf_count_duration = time_record.elapsed();
// large leafs should not bring time inceasing
assert!(large_leaf_count_duration < 2 * small_leaf_count_duration);
} | rust_cleaned_test_functions.jsonl/112988 | {
"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,
5084,
35603,
34967,
3009,
368,
341,
286,
990,
1460,
486,
1678,
486,
30340,
401,
286,
442,
8183,
729,
46028,
29436,
3055,
198,
286,
8755,
23089,
6533,
486,
35597,
13251,
35603,
7,
17,
626,
286,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.