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_encrypt_ledger() {
solana_logger::setup();
let ledger_dir = "chacha_test_encrypt_file";
let ledger_path = get_tmp_ledger_path(ledger_dir);
let ticks_per_slot = 16;
let slots_per_segment = 32;
let blocktree = Arc::new(Blocktree::open(&ledger_path).unwrap());
let out_path = Path::new("test_chacha_encrypt_file_output.txt.enc");
let seed = [2u8; 32];
let mut rnd = GenKeys::new(seed);
let keypair = rnd.gen_keypair();
let entries = make_tiny_deterministic_test_entries(slots_per_segment);
blocktree
.write_entries(
0,
0,
0,
ticks_per_slot,
None,
true,
&Arc::new(keypair),
&entries,
)
.unwrap();
let mut key = hex!(
"abcd1234abcd1234abcd1234abcd1234 abcd1234abcd1234abcd1234abcd1234
abcd1234abcd1234abcd1234abcd1234 abcd1234abcd1234abcd1234abcd1234"
);
chacha_cbc_encrypt_ledger(&blocktree, 0, slots_per_segment as u64, out_path, &mut key)
.unwrap();
let mut out_file = File::open(out_path).unwrap();
let mut buf = vec![];
let size = out_file.read_to_end(&mut buf).unwrap();
let mut hasher = Hasher::default();
hasher.hash(&buf[..size]);
let golden: Hash = "HVUt3uy4it4NgbGgYiG9C3gnvxDCzkgqwzzSCM9N4sSt"
.parse()
.unwrap();
assert_eq!(hasher.result(), golden);
remove_file(out_path).unwrap();
} | rust_cleaned_test_functions.jsonl/57846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 914
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66593,
38367,
1389,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
46933,
4334,
284,
330,
331,
51576,
4452,
66593,
2458,
876,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
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_not_invoke_committed_cb_when_fail_to_commit() {
let mut cluster = new_node_cluster(0, 3);
cluster.pd_client.disable_default_operator();
cluster.run();
cluster.must_transfer_leader(1, new_peer(1, 1));
cluster.must_put(b"k", b"v");
// Partiton the leader and followers to let the leader fails to commit the proposal.
cluster.partition(vec![1], vec![2, 3]);
let write_req = make_write_req(&mut cluster, b"k1");
let (cb, cb_receivers) = make_cb(&write_req);
cluster
.sim
.rl()
.async_command_on_node(1, write_req, cb)
.unwrap();
// Check the request is proposed but not committed.
cb_receivers
.committed
.recv_timeout(Duration::from_millis(200))
.unwrap_err();
cb_receivers.proposed.try_recv().unwrap();
// The election timeout is 250ms by default.
let election_timeout = cluster.cfg.raft_store.raft_base_tick_interval.0
* cluster.cfg.raft_store.raft_election_timeout_ticks as u32;
std::thread::sleep(2 * election_timeout);
// Make sure a new leader is elected and will discard the previous proposal when partition is
// recovered.
cluster.must_put(b"k2", b"v");
cluster.clear_send_filters();
let resp = cb_receivers
.applied
.recv_timeout(Duration::from_secs(1))
.unwrap();
assert!(resp.get_header().has_error(), "{:?}", resp);
// The committed callback shouldn't be invoked.
cb_receivers.committed.try_recv().unwrap_err();
} | rust_cleaned_test_functions.jsonl/50883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 631
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
79779,
2965,
5483,
16450,
47636,
22121,
2346,
36346,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
10652,
556,
67,
8179,
42628,
9993,
40594,
543,
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_is_native_program_id() {
assert!(bpf_loader::id().is_native_program_id());
assert!(bpf_loader_deprecated::id().is_native_program_id());
assert!(config::program::id().is_native_program_id());
assert!(feature::id().is_native_program_id());
assert!(secp256k1_program::id().is_native_program_id());
assert!(stake::program::id().is_native_program_id());
assert!(stake::config::id().is_native_program_id());
assert!(system_program::id().is_native_program_id());
assert!(sysvar::id().is_native_program_id());
assert!(vote::program::id().is_native_program_id());
} | rust_cleaned_test_functions.jsonl/61817 | {
"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,
6892,
44494,
25096,
842,
368,
341,
286,
2060,
10297,
65,
15897,
22139,
486,
307,
1005,
285,
44494,
25096,
842,
1423,
286,
2060,
10297,
65,
15897,
22139,
2259,
19889,
486,
307,
1005,
285,
44494,
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_sbc_imm() {
let mut r = Register::new();
r.set_A(0x03);
r.set_status_carry(true);
sbc_imm(0x02, &mut r);
assert_eq!(r.get_A(),0x01);
assert_eq!(r.get_status_overflow(), false);
r.set_A(0x04);
r.set_status_carry(false);
sbc_imm(0x03, &mut r);
assert_eq!(r.get_A(),0x00);
assert_eq!(r.get_status_overflow(), false);
r.set_A(0x01);
r.set_status_carry(true);
sbc_imm(0x80, &mut r);
assert_eq!(r.get_status_overflow(), true);
} | rust_cleaned_test_functions.jsonl/14223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
8904,
71370,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
435,
980,
1566,
7,
15,
87,
15,
18,
317,
262,
435,
980,
4773,
666,
11433,
3715,
317,
262,
7898,
66,
71370,
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_generate_pull_responses() {
let mut node_crds = Crds::default();
let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
0,
)));
let node_pubkey = entry.label().pubkey();
let node = CrdsGossipPull::default();
node_crds.insert(entry, 0).unwrap();
let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
0,
)));
node_crds.insert(new, 0).unwrap();
let req = node.new_pull_request(
&node_crds,
&node_pubkey,
0,
0,
&HashMap::new(),
PACKET_DATA_SIZE,
);
let mut dest_crds = Crds::default();
let dest = CrdsGossipPull::default();
let (_, filters, caller) = req.unwrap();
let mut filters: Vec<_> = filters.into_iter().map(|f| (caller.clone(), f)).collect();
let rsp = dest.generate_pull_responses(&dest_crds, &filters, 0);
assert_eq!(rsp[0].len(), 0);
let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
CRDS_GOSSIP_PULL_MSG_TIMEOUT_MS,
)));
dest_crds
.insert(new, CRDS_GOSSIP_PULL_MSG_TIMEOUT_MS)
.unwrap();
//should skip new value since caller is to old
let rsp =
dest.generate_pull_responses(&dest_crds, &filters, CRDS_GOSSIP_PULL_MSG_TIMEOUT_MS);
assert_eq!(rsp[0].len(), 0);
assert_eq!(filters.len(), 1);
filters.push(filters[0].clone());
//should return new value since caller is new
filters[1].0 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
CRDS_GOSSIP_PULL_MSG_TIMEOUT_MS + 1,
)));
let rsp =
dest.generate_pull_responses(&dest_crds, &filters, CRDS_GOSSIP_PULL_MSG_TIMEOUT_MS);
assert_eq!(rsp.len(), 2);
assert_eq!(rsp[0].len(), 0);
assert_eq!(rsp[1].len(), 1); // Orders are also preserved.
} | rust_cleaned_test_functions.jsonl/45199 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
65693,
81292,
368,
341,
286,
1077,
5206,
2436,
32331,
5356,
284,
4553,
5356,
486,
2258,
543,
286,
1077,
4343,
284,
4553,
5356,
1130,
486,
931,
67830,
3025,
81,
5356,
1043,
486,
8732,
1731,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sort() {
let a = Int32Chunked::new(
"a",
&[
Some(1),
Some(5),
None,
Some(1),
None,
Some(4),
Some(3),
Some(1),
],
);
let out = a.sort_with(SortOptions {
descending: false,
nulls_last: false,
});
assert_eq!(
Vec::from(&out),
&[
None,
None,
Some(1),
Some(1),
Some(1),
Some(3),
Some(4),
Some(5)
]
);
let out = a.sort_with(SortOptions {
descending: false,
nulls_last: true,
});
assert_eq!(
Vec::from(&out),
&[
Some(1),
Some(1),
Some(1),
Some(3),
Some(4),
Some(5),
None,
None
]
);
} | rust_cleaned_test_functions.jsonl/16390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 821
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
28304,
291,
486,
931,
1006,
310,
330,
64,
756,
310,
609,
9640,
394,
4329,
7,
16,
1326,
394,
4329,
7,
20,
1326,
394,
2240,
345,
394,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_straight() {
let test_str = "123456789m78p22z 9p";
let test = Hand::from(test_str);
let test_analyzer = HandAnalyzer::new(&test).unwrap();
let mut status = Status::new();
let settings = Settings::new();
status.has_claimed_open = false;
assert_eq!(
check_straight(&test_analyzer, &status, &settings).unwrap(),
("一気通貫", true, 2)
);
} | rust_cleaned_test_functions.jsonl/5174 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
7386,
368,
341,
286,
1077,
1273,
2895,
284,
330,
16,
17,
18,
19,
20,
21,
22,
23,
24,
76,
22,
23,
79,
17,
17,
89,
220,
24,
79,
876,
286,
1077,
1273,
284,
8536,
486,
1499,
8623,
2895... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fields_fixed32() {
let mut message = TestUnknownFields::new();
message.set_a(150);
message.mut_unknown_fields().add_fixed32(4, 0x01020304);
message.mut_unknown_fields().add_fixed32(4, 0xA1A2A3A4);
test_serialize_deserialize_with_dynamic("08 96 01 25 04 03 02 01 25 A4 A3 A2 A1", &message);
} | rust_cleaned_test_functions.jsonl/2710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
12132,
37839,
18,
17,
368,
341,
262,
1077,
5206,
1943,
284,
3393,
13790,
8941,
486,
931,
543,
262,
1943,
980,
4306,
7,
16,
20,
15,
317,
262,
1943,
744,
332,
57507,
12132,
1005,
718,
378... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_failed_name_server() {
let options = ResolverOpts {
timeout: Duration::from_millis(1),
..Default::default()
};
let config = NameServerConfig {
socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 252)), 252),
protocol: Protocol::Udp,
tls_dns_name: None,
trust_nx_responses: false,
#[cfg(feature = "dns-over-rustls")]
tls_config: None,
};
let io_loop = Runtime::new().unwrap();
let runtime_handle = TokioHandle;
let name_server = future::lazy(|_| {
NameServer::<_, TokioConnectionProvider>::new(config, options, runtime_handle)
});
let name = Name::parse("www.example.com.", None).unwrap();
assert!(io_loop
.block_on(name_server.then(|mut name_server| {
name_server
.lookup(
Query::query(name.clone(), RecordType::A),
DnsRequestOptions::default(),
)
.first_answer()
}))
.is_err());
} | rust_cleaned_test_functions.jsonl/18438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 635
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35060,
1269,
12015,
368,
341,
286,
1077,
2606,
284,
81854,
43451,
341,
310,
9632,
25,
21045,
486,
1499,
717,
56212,
7,
16,
701,
715,
310,
5241,
3675,
486,
2258,
741,
286,
2605,
286,
1077,
2193,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_small() {
let mut val = Vec::new();
val.insert(0, 0x00);
val.insert(1, 0x11);
val.insert(2, 0x22);
val.insert(3, 0x33);
wrap_in_sequence(&mut val);
assert_eq!(vec![0x30, 0x04, 0x00, 0x11, 0x22, 0x33], val);
} | rust_cleaned_test_functions.jsonl/89555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31966,
368,
341,
262,
1077,
5206,
1044,
284,
11312,
486,
931,
543,
262,
1044,
7030,
7,
15,
11,
220,
15,
87,
15,
15,
317,
262,
1044,
7030,
7,
16,
11,
220,
15,
87,
16,
16,
317,
262,
1044,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compact_options() {
let path = tempdir_with_prefix("_rust_rocksdb_compact_options");
let db = DB::open_default(path.path().to_str().unwrap()).unwrap();
db.put(b"k1", b"v1").unwrap();
db.put(b"k2", b"v2").unwrap();
db.flush(true).unwrap();
let mut compact_opts = CompactOptions::new();
compact_opts.set_exclusive_manual_compaction(false);
let cf = db.cf_handle("default").unwrap();
db.compact_range_cf_opt(cf, &compact_opts, None, None);
} | rust_cleaned_test_functions.jsonl/34111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18177,
531,
8743,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
18177,
531,
8743,
797,
262,
1077,
2927,
284,
5952,
486,
2508,
9993,
5581,
3875,
1005,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add() {
assert_eq!(_05_05i + _05_05i, _1_1i);
assert_eq!(_0_1i + _1_0i, _1_1i);
assert_eq!(_1_0i + _neg1_1i, _0_1i);
for &c in all_consts.iter() {
assert_eq!(_0_0i + c, c);
assert_eq!(c + _0_0i, c);
}
} | rust_cleaned_test_functions.jsonl/108413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
368,
341,
310,
2060,
10714,
0,
2490,
15,
20,
62,
15,
20,
72,
488,
716,
15,
20,
62,
15,
20,
72,
11,
716,
16,
62,
16,
72,
317,
310,
2060,
10714,
0,
2490,
15,
62,
16,
72,
488,
716,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bad_message_size() {
let batch_msg = Track {
user: User::UserId {
user_id: String::from_utf8(vec![b'a'; 1024 * 33]).unwrap(),
},
..Default::default()
};
let mut batcher = Batcher::new(None);
let result = batcher.push(batch_msg);
let err = result.err().unwrap();
assert!(err.to_string().contains("message too large"));
} | rust_cleaned_test_functions.jsonl/35280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
6462,
2368,
368,
341,
286,
1077,
7162,
6483,
284,
19785,
341,
310,
1196,
25,
2657,
486,
13504,
341,
394,
1196,
842,
25,
923,
486,
1499,
39453,
23,
25592,
20703,
65,
25184,
6967,
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 |
#[test]
fn test_three_dot_two() -> Result<()> {
let idt = id("3.2");
assert_eq!(idt.to_string(), "n3_2");
Ok(())
} | rust_cleaned_test_functions.jsonl/2017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50016,
30941,
23241,
368,
1464,
5714,
71698,
341,
286,
1077,
877,
83,
284,
877,
445,
18,
13,
17,
797,
286,
2060,
10714,
10297,
307,
83,
2389,
3904,
1507,
330,
77,
18,
62,
17,
797,
286,
7622,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_find() {
let bytes: &[u8; 13] = b"abcacrgbabsjl";
let i = find(&bytes[..], b"ac");
assert_eq!(i.unwrap(), 3);
let i = find(&bytes[..], b"rgb");
assert_eq!(i.unwrap(), 5);
let i = find(&bytes[..], b"ab");
assert_eq!(i.unwrap(), 0);
let i = find(&bytes[..], b"l");
assert_eq!(i.unwrap(), 12);
let i = find(&bytes[..], b"jle");
assert!(i.is_none());
let i = find(&bytes[..], b"asdkjhasjhdjhgsadg");
assert!(i.is_none());
let i = find(&bytes[..], b"abcacrgbabsjl");
assert_eq!(i.unwrap(), 0);
} | rust_cleaned_test_functions.jsonl/41853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
368,
341,
286,
1077,
5820,
25,
44590,
84,
23,
26,
220,
16,
18,
60,
284,
293,
1,
13683,
580,
16509,
3435,
43870,
876,
286,
1077,
600,
284,
1477,
2099,
9651,
95874,
1125,
293,
1,
580,
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_parse_complete_msg_sequence() {
init_tracing();
let mut decoder = MongoProtocolDecoder::new();
let mut buf = Vec::new();
// Write the first message
let msg_buf = create_message("insert", "foo");
let hdr = create_header(1234, 5678, msg_buf.len());
hdr.write(&mut buf).unwrap();
buf.extend(&msg_buf);
// Now write the second message
let msg_buf = create_message("delete", "bar");
let hdr = create_header(5678, 1234, msg_buf.len());
hdr.write(&mut buf).unwrap();
buf.extend(&msg_buf);
// Parse and validate the messages
let result = decoder.decode_messages(&buf).unwrap();
assert_eq!(result.len(), 2);
let mut it = result.iter();
match it.next().unwrap() {
(_, MongoMessage::Msg(m)) => {
assert_eq!(m.documents.len(), 1);
assert_eq!(m.documents[0].get_str("op").unwrap(), "insert");
assert_eq!(m.documents[0].get_str("op_value").unwrap(), "foo");
},
other => panic!("Couldn't parse the first message, got something else: {:?}", other),
}
match it.next().unwrap() {
(_, MongoMessage::Msg(m)) => {
assert_eq!(m.documents.len(), 1);
assert_eq!(m.documents[0].get_str("op").unwrap(), "delete");
assert_eq!(m.documents[0].get_str("op_value").unwrap(), "bar");
},
other => panic!("Couldn't parse the second message, got something else: {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/84747 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 779
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
27675,
6483,
23735,
368,
341,
286,
2930,
3547,
4527,
1428,
286,
1077,
5206,
24551,
284,
24415,
20689,
20732,
486,
931,
543,
286,
1077,
5206,
6607,
284,
11312,
486,
931,
1428,
286,
442,
9645... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multiple() {
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
create_branch(repo_path, "test").unwrap();
assert_eq!(
get_branches_info(repo_path)
.unwrap()
.iter()
.map(|b| b.name.clone())
.collect::<Vec<_>>(),
vec!["master", "test"]
);
} | rust_cleaned_test_functions.jsonl/96504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
368,
341,
286,
1077,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
1005,
15454,
543,
286,
1077,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
286,
1077,
15867,
2638,
284,
3704,
5357,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_edge_with_weights_undirected() {
let mut g = MatrixGraph::new_undirected();
let a = g.add_node('a');
let b = g.add_node('b');
let c = g.add_node('c');
let d = g.add_node('d');
g.add_edge(a, b, "ab");
g.add_edge(a, a, "aa");
g.add_edge(b, c, "bc");
g.add_edge(d, d, "dd");
assert_eq!(*g.edge_weight(a, b), "ab");
assert_eq!(*g.edge_weight(b, c), "bc");
} | rust_cleaned_test_functions.jsonl/81961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
17932,
6615,
21114,
62,
1241,
74612,
368,
341,
286,
1077,
5206,
342,
284,
11631,
11212,
486,
931,
62,
1241,
74612,
543,
286,
1077,
264,
284,
342,
1364,
5084,
492,
64,
1157,
286,
1077,
293,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_element_to_octets() {
let x = Bignum::new_from_slice(&TEST_PWE_X[..]).unwrap();
let y = Bignum::new_from_slice(&TEST_PWE_Y[..]).unwrap();
let group = make_group();
let element = EcPoint::new_from_affine_coords(x, y, &group.group, &group.bn_ctx).unwrap();
let octets = group.element_to_octets(&element).unwrap();
let mut expected = TEST_PWE_X.to_vec();
expected.extend_from_slice(&TEST_PWE_Y[..]);
assert_eq!(octets, expected);
} | rust_cleaned_test_functions.jsonl/48495 | {
"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,
7894,
2346,
70135,
1415,
368,
341,
286,
1077,
856,
284,
425,
92160,
486,
931,
5673,
26488,
2099,
10033,
1088,
12457,
6859,
95874,
10697,
15454,
543,
286,
1077,
379,
284,
425,
92160,
486,
931,
5673... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fixed_size_binary_null() {
let a = create_fixed_size_binary_array(&[Some(b"hello"), None, Some(b"world")]);
let b = create_fixed_size_binary_array(&[Some(b"hello"), None, Some(b"world")]);
test_equal(&a, &b, true);
let b = create_fixed_size_binary_array(&[Some(b"hello"), Some(b"world"), None]);
test_equal(&a, &b, false);
let b = create_fixed_size_binary_array(&[Some(b"hello"), None, Some(b"arrow")]);
test_equal(&a, &b, false);
} | rust_cleaned_test_functions.jsonl/24220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37839,
2368,
31761,
15162,
368,
341,
286,
1077,
264,
284,
1855,
37839,
2368,
31761,
3858,
2099,
58,
8373,
1883,
1,
14990,
3975,
2240,
11,
4329,
1883,
1,
14615,
899,
2558,
286,
1077,
293,
284,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_indexed_i64() {
let mut schema_builder = Schema::builder();
let value_field = schema_builder.add_i64_field("value", INDEXED);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
let mut index_writer = index.writer_with_num_threads(1, 3_000_000).unwrap();
let negative_val = -1i64;
index_writer.add_document(doc!(value_field => negative_val));
index_writer.commit().unwrap();
let reader = index.reader().unwrap();
let searcher = reader.searcher();
let term = Term::from_field_i64(value_field, negative_val);
let mut postings = searcher
.segment_reader(0)
.inverted_index(term.field())
.read_postings(&term, IndexRecordOption::Basic)
.unwrap();
assert!(postings.advance());
assert_eq!(postings.doc(), 0);
assert!(!postings.advance());
} | rust_cleaned_test_functions.jsonl/41947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
291,
5318,
21,
19,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
897,
5013,
284,
10802,
28532,
1364,
5318,
21,
19,
5013,
445,
957,
497,
39300,
1479,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_too_many_requested() {
let tmp_dir = TempPath::new();
let db = LibraDB::new_for_test(&tmp_dir);
assert!(db.get_transactions(0, 1001 /* limit */, 0, true).is_err());
} | rust_cleaned_test_functions.jsonl/7143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
78,
22101,
72709,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
1820,
486,
931,
543,
262,
1077,
2927,
284,
5688,
956,
3506,
486,
931,
5478,
4452,
2099,
5173,
4334,
626,
262,
2060,
10297,
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_convert_monotype_int() {
let b = ast::BaseNode::default();
let monotype = ast::MonoType::Basic(ast::NamedType {
base: b.clone(),
name: ast::Identifier {
base: b.clone(),
name: "int".to_string(),
},
});
let mut m = BTreeMap::<String, types::Tvar>::new();
let got = convert_monotype(monotype, &mut m, &mut fresh::Fresher::default()).unwrap();
let want = MonoType::Int;
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/30460 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
20737,
4156,
4042,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
1615,
4156,
284,
11763,
486,
58946,
929,
486,
15944,
52574,
486,
15810,
929,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_majority() {
let (_, peer) = new_cluster(1).into_iter().next().unwrap();
assert_eq!(1, peer.majority());
let (_, peer) = new_cluster(2).into_iter().next().unwrap();
assert_eq!(2, peer.majority());
let (_, peer) = new_cluster(3).into_iter().next().unwrap();
assert_eq!(2, peer.majority());
let (_, peer) = new_cluster(4).into_iter().next().unwrap();
assert_eq!(3, peer.majority());
} | rust_cleaned_test_functions.jsonl/117882 | {
"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,
47916,
487,
368,
341,
286,
1077,
39464,
14397,
8,
284,
501,
28441,
7,
16,
568,
18122,
11723,
1005,
3600,
1005,
15454,
543,
286,
2060,
10714,
10297,
16,
11,
14397,
75412,
487,
5231,
286,
1077,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_graph_query() {
let data_dir = "data/large_data";
let root_dir = "data/large_data";
let schema_file = "data/schema.json";
let mut loader =
GraphLoader::<DefaultId, u32>::new(data_dir, root_dir, schema_file, 20, 0, 1);
// load whole graph
loader.load().expect("Load graph error!");
let graphdb = loader.into_graph();
check_graph(&graphdb);
} | rust_cleaned_test_functions.jsonl/22816 | {
"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,
14738,
5738,
368,
341,
286,
1077,
821,
4334,
284,
330,
691,
13328,
2744,
1769,
876,
286,
1077,
3704,
4334,
284,
330,
691,
13328,
2744,
1769,
876,
286,
1077,
10802,
2458,
284,
330,
691,
61142,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_dictionary_overflow() {
let key_builder = PrimitiveBuilder::<UInt8Type>::new(257);
let value_builder = PrimitiveBuilder::<UInt32Type>::new(257);
let mut builder = PrimitiveDictionaryBuilder::new(key_builder, value_builder);
// 256 unique keys.
for i in 0..256 {
builder.append(i + 1000).unwrap();
}
builder.append(1257).unwrap();
} | rust_cleaned_test_functions.jsonl/31004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
42605,
79073,
368,
341,
286,
1077,
1376,
28532,
284,
51460,
3297,
27638,
18777,
23,
929,
6831,
931,
7,
17,
20,
22,
317,
286,
1077,
897,
28532,
284,
51460,
3297,
27638,
18777,
18,
17,
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... | 2 |
#[test]
fn test_syntax_node_iterator() {
let first_tag = SyntaxNode::Tag(Tag {
name: "h2".to_string(),
self_closed: false,
attributes: vec![],
children: vec![],
});
let child_plain = SyntaxNode::Plain(Plain {
plain: "hello world".to_string(),
});
let second_tag = SyntaxNode::Tag(Tag {
name: "div".to_string(),
self_closed: false,
attributes: vec![TagAttribute::HtmlAttribute(HtmlAttribute {
name: "class".to_string(),
value: Some("main".to_string()),
})],
children: vec![child_plain.clone()],
});
let block = SyntaxNode::TwigStructure(TwigStructure::TwigBlock(TwigBlock {
name: "main".to_string(),
children: vec![first_tag.clone(), second_tag.clone()],
}));
let root = SyntaxNode::Root(vec![block.clone()]);
let mut tree_iter = root.iter();
assert_eq!(tree_iter.next(), Some(&root));
assert_eq!(tree_iter.next(), Some(&block));
assert_eq!(tree_iter.next(), Some(&first_tag));
assert_eq!(tree_iter.next(), Some(&second_tag));
assert_eq!(tree_iter.next(), Some(&child_plain));
assert_eq!(tree_iter.next(), None);
} | rust_cleaned_test_functions.jsonl/62787 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 653
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78894,
5084,
13491,
368,
341,
286,
1077,
1156,
9372,
284,
32117,
1955,
486,
5668,
69161,
341,
310,
829,
25,
330,
71,
17,
3263,
983,
3904,
3148,
310,
656,
44697,
25,
895,
345,
310,
8201,
25,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exception() {
let code = String::from(system_header) + "\
; write 0x01, trigger trap, write 0x02, terminate
(j RESET_HANDLER)
(nop)
(nop)
(nop)
(: TRAP_VECTOR)
; write 0x02
(li t1 0x02)
(sw t3 t1 0)
; done
(lui t4 end_pc_target)
(addi t4 t4 end_pc_target)
(jalr zero t4 0)
(: RESET_HANDLER)
; t3 = output
(lui t3 output)
(addi t3 t3 output)
(li t1 0x01)
(sw t3 t1 0)
; trigger exception
; LOAD_ACCESS_MISALIGNED
(lw zero zero 0x2)
";
let output = test_for_output(&code, false);
assert_eq!(&output, &[1u8, 2u8]);
} | rust_cleaned_test_functions.jsonl/125912 | {
"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,
17499,
368,
341,
262,
1077,
2038,
284,
923,
486,
1499,
46006,
8757,
8,
488,
93317,
26,
3270,
220,
15,
87,
15,
16,
11,
8183,
22862,
11,
3270,
220,
15,
87,
15,
17,
11,
29654,
198,
3325,
53215,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flags_from_vec_10() {
// notice that flags passed after double dash will not
// be parsed to DenoFlags but instead forwarded to
// script args as Deno.args
let (flags, subcommand, argv) = flags_from_vec(svec![
"deno",
"run",
"--allow-write",
"script.ts",
"--",
"-D",
"--allow-net"
]);
assert_eq!(
flags,
DenoFlags {
allow_write: true,
..DenoFlags::default()
}
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(argv, svec!["deno", "script.ts", "--", "-D", "--allow-net"]);
} | rust_cleaned_test_functions.jsonl/112839 | {
"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,
14130,
5673,
13251,
62,
16,
15,
368,
341,
262,
442,
5293,
429,
8042,
5823,
1283,
1990,
23911,
686,
537,
198,
262,
442,
387,
15676,
311,
9774,
78,
9195,
714,
4518,
52246,
311,
198,
262,
442,
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,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compare() {
assert!(Angle::<f32>::n_pi(1.5) > Angle::<f32>::n_pi(0.5));
assert!(Angle::<f32>::n_pi(1.0) < Angle::<f32>::n_pi(2.0));
assert!(Angle::<f32>::degrees(90.0) > Angle::<f32>::degrees(45.0));
assert!(Angle::<f32>::degrees(30.0) < Angle::<f32>::degrees(60.0));
assert!(Angle::<f32>::n_pi(2.0) > Angle::<f32>::degrees(300.0));
assert!(Angle::<f32>::n_pi(0.5) < Angle::<f32>::degrees(135.0));
} | rust_cleaned_test_functions.jsonl/7223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32235,
368,
341,
286,
2060,
10297,
15939,
27638,
69,
18,
17,
6831,
77,
47771,
7,
16,
13,
20,
8,
861,
36237,
27638,
69,
18,
17,
6831,
77,
47771,
7,
15,
13,
20,
1106,
286,
2060,
10297,
15939,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitv_set_difference() {
let mut a = BitvSet::new();
let mut b = BitvSet::new();
assert!(a.insert(1));
assert!(a.insert(3));
assert!(a.insert(5));
assert!(a.insert(200));
assert!(a.insert(500));
assert!(b.insert(3));
assert!(b.insert(200));
let mut i = 0;
let expected = [1, 5, 500];
a.difference(&b, |x| {
assert_eq!(*x, expected[i]);
i += 1;
true
});
assert_eq!(i, expected.len());
} | rust_cleaned_test_functions.jsonl/12157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
85,
2602,
47525,
368,
341,
286,
1077,
5206,
264,
284,
6495,
85,
1649,
486,
931,
543,
286,
1077,
5206,
293,
284,
6495,
85,
1649,
486,
931,
1428,
286,
2060,
10297,
64,
7030,
7,
16,
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_read_metadata_compressor_none() {
let temp = TempFile::new().unwrap();
let mut w = OpenOptions::new()
.read(true)
.write(true)
.open(temp.as_path())
.unwrap();
let r = OpenOptions::new()
.read(true)
.write(false)
.open(temp.as_path())
.unwrap();
let chunks = vec![
BlobChunkInfoOndisk {
uncomp_info: 0x01ff_f000_0000_0000,
comp_info: 0x00ff_f000_0000_0000,
},
BlobChunkInfoOndisk {
uncomp_info: 0x01ff_f000_0010_0000,
comp_info: 0x00ff_f000_0010_0000,
},
];
let data = unsafe {
std::slice::from_raw_parts(
chunks.as_ptr() as *const u8,
chunks.len() * std::mem::size_of::<BlobChunkInfoOndisk>(),
)
};
let pos = 0;
w.write_all(&data).unwrap();
let mut blob_info = BlobInfo::new(
0,
"dummy".to_string(),
0,
0,
RAFS_MAX_CHUNK_SIZE as u32,
0,
BlobFeatures::default(),
);
blob_info.set_blob_meta_info(
0,
pos,
data.len() as u64,
data.len() as u64,
compress::Algorithm::None as u32,
);
let mut buffer = Vec::with_capacity(data.len());
unsafe { buffer.set_len(data.len()) };
let reader: Arc<dyn BlobReader> = Arc::new(DummyBlobReader {
metrics: BackendMetrics::new("dummy", "localfs"),
file: r,
});
BlobMetaInfo::read_metadata(&blob_info, &reader, &mut buffer).unwrap();
assert_eq!(buffer, data);
} | rust_cleaned_test_functions.jsonl/37904 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1044
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
22220,
2965,
56220,
31488,
368,
341,
286,
1077,
2730,
284,
19944,
1703,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
289,
284,
5264,
3798,
486,
931,
741,
310,
659,
878,
3715,
340,
310,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_append_permutations() {
fn construct_vec_deque(
push_back: usize,
pop_back: usize,
push_front: usize,
pop_front: usize,
) -> VecDeque<usize> {
let mut out = VecDeque::new();
for a in 0..push_back {
out.push_back(a);
}
for b in 0..push_front {
out.push_front(push_back + b);
}
for _ in 0..pop_back {
out.pop_back();
}
for _ in 0..pop_front {
out.pop_front();
}
out
}
// Miri is too slow
let max = if cfg!(miri) { 3 } else { 5 };
// Many different permutations of both the `VecDeque` getting appended to
// and the one getting appended are generated to check `append`.
// This ensures all 6 code paths of `append` are tested.
for src_push_back in 0..max {
for src_push_front in 0..max {
// doesn't pop more values than are pushed
for src_pop_back in 0..(src_push_back + src_push_front) {
for src_pop_front in 0..(src_push_back + src_push_front - src_pop_back) {
let src = construct_vec_deque(
src_push_back,
src_pop_back,
src_push_front,
src_pop_front,
);
for dst_push_back in 0..max {
for dst_push_front in 0..max {
for dst_pop_back in 0..(dst_push_back + dst_push_front) {
for dst_pop_front in
0..(dst_push_back + dst_push_front - dst_pop_back)
{
let mut dst = construct_vec_deque(
dst_push_back,
dst_pop_back,
dst_push_front,
dst_pop_front,
);
let mut src = src.clone();
// Assert that appending `src` to `dst` gives the same order
// of values as iterating over both in sequence.
let correct = dst
.iter()
.chain(src.iter())
.cloned()
.collect::<Vec<usize>>();
dst.append(&mut src);
assert_eq!(dst, correct);
assert!(src.is_empty());
}
}
}
}
}
}
}
}
} | rust_cleaned_test_functions.jsonl/124917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1892
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
31961,
82141,
368,
341,
262,
5168,
9245,
13251,
2259,
591,
1006,
286,
4484,
3895,
25,
22301,
345,
286,
2420,
3895,
25,
22301,
345,
286,
4484,
22926,
25,
22301,
345,
286,
2420,
22926,
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... | 5 |
#[test]
fn test_header_encode_correctness() {
use serialize;
let correct = [
0x24, 0x0, 0x0, 0x34, 0x29, 0xb9, 0x36, 0xa9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x2, 0x0, 0x0, 0x0,
];
let header: Header = Header::new(36, true, 2838935849, 0, false, true, 0, 2);
assert_eq!(&correct[..], &serialize::encode(&header).unwrap()[..])
} | rust_cleaned_test_functions.jsonl/52296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
11224,
31550,
2090,
368,
341,
220,
990,
24235,
401,
220,
1077,
4396,
284,
2278,
262,
220,
15,
87,
17,
19,
11,
220,
15,
87,
15,
11,
220,
15,
87,
15,
11,
220,
15,
87,
18,
19,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prepare_job() {
let dir = TempDir::new("test_import_prepare_job").unwrap();
let uuid = Uuid::new_v4();
let db_cfg = DbConfig::default();
let security_cfg = SecurityConfig::default();
let engine = Arc::new(Engine::new(dir.path(), uuid, db_cfg, security_cfg).unwrap());
// Generate entries to prepare.
let (n, m) = (4, 4);
// This size if pre-calculated.
let index_size = 10;
for i in 0..n {
for j in 0..m {
let v = &[i + j * n + 1];
let k = new_encoded_key(v);
engine.put(&k, v).unwrap();
assert_eq!(k.len() + v.len(), index_size);
engine.flush(true).unwrap();
}
}
let mut cfg = Config::default();
// We have n * m = 16 entries and 4 jobs.
cfg.num_import_jobs = 4;
// Each region contains at most 3 entries.
cfg.region_split_size.0 = index_size as u64 * 3;
// Expected ranges returned by the prepare job.
let ranges = vec![
(vec![], vec![4]),
(vec![4], vec![8]),
(vec![8], vec![12]),
(vec![12], vec![]),
];
// Test with an empty range.
{
let mut client = MockClient::new();
client.add_region_range(b"", b"");
// Expected region ranges returned by the prepare job.
let region_ranges = vec![
(vec![], vec![3], true),
(vec![3], vec![6], true),
(vec![6], vec![9], true),
(vec![9], vec![12], true),
(vec![12], vec![15], true),
(vec![15], vec![], false),
];
run_and_check_prepare_job(
cfg.clone(),
client,
Arc::clone(&engine),
&ranges,
®ion_ranges,
);
}
// Test with some segmented region ranges.
{
let mut client = MockClient::new();
let keys = vec![
5,
7,
15,
];
let mut last = Vec::new();
for i in keys {
let k = new_encoded_key(&[i]);
client.add_region_range(&last, &k);
last = k.clone();
}
client.add_region_range(&last, b"");
// Expected region ranges returned by the prepare job.
let region_ranges = vec![
(vec![], vec![3], true),
(vec![3], vec![5], false),
(vec![5], vec![7], false),
(vec![7], vec![10], true),
(vec![10], vec![13], true),
(vec![13], vec![15], false),
(vec![15], vec![], false),
];
run_and_check_prepare_job(
cfg.clone(),
client,
Arc::clone(&engine),
&ranges,
®ion_ranges,
);
}
} | rust_cleaned_test_functions.jsonl/101455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1806
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47460,
20298,
368,
341,
286,
1077,
5419,
284,
19944,
6184,
486,
931,
445,
1944,
18434,
47460,
20298,
1827,
15454,
543,
286,
1077,
16040,
284,
547,
2423,
486,
931,
2273,
19,
543,
286,
1077,
2927,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_seckey_from_bytes_zero() {
// Zero is not a valid exponent for a secret key.
let bytes = [0; 32];
let sk = SecKey::from_bytes(&bytes);
assert!(sk.is_none());
} | rust_cleaned_test_functions.jsonl/81720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3453,
377,
1195,
5673,
12524,
19359,
368,
341,
286,
442,
18306,
374,
537,
264,
2697,
27690,
369,
264,
6234,
1376,
624,
286,
1077,
5820,
284,
508,
15,
26,
220,
18,
17,
935,
286,
1077,
1901,
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 |
#[test]
fn test_pool_subaccount() {
let sub_account: AccountId32 =
pool_sub_account(1, &WorkerPublicKey::from_raw([0u8; 32]));
let expected = AccountId32::new(hex!(
"73706d2f02ab4d74c86ec3b3997a4fadf33e55e8279650c8539ea67e053c02dc"
));
assert_eq!(sub_account, expected, "Incorrect sub account");
} | rust_cleaned_test_functions.jsonl/60457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15709,
5228,
4608,
368,
341,
298,
10217,
1186,
13500,
25,
8615,
764,
18,
17,
4035,
571,
85273,
5228,
13500,
7,
16,
11,
609,
21936,
61822,
486,
1499,
16067,
2561,
15,
84,
23,
26,
220,
18,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_maybe_prompted_string_confirm_mismatch() {
let (ctx, is, os) = create_normal_test_context("foo\nbar\nfoo\nfoo\n");
let mps = MaybePromptedString::new(
/*provided=*/ None,
is,
os,
TEST_PROMPT,
/*is_sensitive=*/ false,
/*confirm=*/ true,
)
.unwrap();
assert!(!mps.was_provided());
assert_eq!("foo", mps.into_inner());
assert!(ctx.has_default_attributes());
assert_eq!(
format!("{}Confirm: {}Confirm: ", TEST_PROMPT, TEST_PROMPT),
ctx.write_buffer_as_str().unwrap()
);
} | rust_cleaned_test_functions.jsonl/110987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
49791,
61421,
291,
3904,
23800,
717,
24976,
368,
341,
262,
1077,
320,
3773,
11,
374,
11,
2643,
8,
284,
1855,
13973,
4452,
8467,
445,
7975,
1699,
2257,
1699,
7975,
1699,
7975,
1699,
797,
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_calculate_fee_compute_units() {
let fee_structure = FeeStructure::default();
let max_fee = fee_structure.compute_fee_bins.last().unwrap().fee;
let lamports_per_signature = fee_structure.lamports_per_signature;
let message =
SanitizedMessage::try_from(Message::new(&[], Some(&Pubkey::new_unique()))).unwrap();
assert_eq!(
Bank::calculate_fee(&message, 1, &fee_structure, true),
max_fee + lamports_per_signature
);
let ix0 = system_instruction::transfer(&Pubkey::new_unique(), &Pubkey::new_unique(), 1);
let ix1 = system_instruction::transfer(&Pubkey::new_unique(), &Pubkey::new_unique(), 1);
let message =
SanitizedMessage::try_from(Message::new(&[ix0, ix1], Some(&Pubkey::new_unique())))
.unwrap();
assert_eq!(
Bank::calculate_fee(&message, 1, &fee_structure, true),
max_fee + 3 * lamports_per_signature
);
// Explicit fee schedule
let expected_fee_structure = &[
(0, 0.0),
(5_000, 0.0),
(10_000, 0.0),
(100_000, 0.0),
(300_000, 0.0),
(500_000, 0.0),
(700_000, 0.0),
(900_000, 0.0),
(1_100_000, 0.0),
(1_300_000, 0.0),
(1_500_000, 0.0), // ComputeBudget capped
];
for pair in expected_fee_structure.iter() {
const ADDITIONAL_FEE: u64 = 42;
let ix0 = ComputeBudgetInstruction::request_units(pair.0, ADDITIONAL_FEE as u32);
let ix1 = Instruction::new_with_bincode(Pubkey::new_unique(), &0, vec![]);
let message =
SanitizedMessage::try_from(Message::new(&[ix0, ix1], Some(&Pubkey::new_unique())))
.unwrap();
let fee = Bank::calculate_fee(&message, 1, &fee_structure, true);
assert_eq!(
fee,
sol_to_lamports(pair.1) + lamports_per_signature + ADDITIONAL_FEE
);
}
} | rust_cleaned_test_functions.jsonl/71095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
34305,
57028,
28345,
368,
341,
286,
1077,
11060,
38283,
284,
40458,
22952,
486,
2258,
543,
286,
1077,
1932,
34305,
284,
11060,
38283,
35347,
34305,
44912,
9110,
1005,
15454,
1005,
30017,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_is_non_loader_key() {
let key0 = Pubkey::new_unique();
let key1 = Pubkey::new_unique();
let loader2 = Pubkey::new_unique();
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let message = Message::new_with_compiled_instructions(
1,
0,
2,
vec![key0, key1, loader2],
Hash::default(),
instructions,
);
let mut helper = MessageProgramIdsCache::new(&message);
assert!(message.is_non_loader_key(&key0, 0));
assert!(message.is_non_loader_key(&key1, 1));
assert!(!message.is_non_loader_key(&loader2, 2));
assert!(helper.is_non_loader_key(&key0, 0));
assert!(helper.is_non_loader_key(&key1, 1));
assert!(!helper.is_non_loader_key(&loader2, 2));
} | rust_cleaned_test_functions.jsonl/116736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
21637,
22139,
3097,
368,
341,
286,
1077,
1376,
15,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
1376,
16,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
16047,
17,
284,
22611,
792,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gamepad_disconnected_event() {
let event: GamepadDisconnectedEvent = js!(
return new GamepadEvent("gamepaddisconnected");
).try_into().unwrap();
assert_eq!(event.event_type(), "gamepaddisconnected");
} | rust_cleaned_test_functions.jsonl/83266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18547,
13242,
9932,
15288,
6748,
368,
1476,
286,
1077,
1538,
25,
4050,
13242,
77021,
1556,
284,
6994,
33673,
310,
470,
501,
4050,
13242,
1556,
445,
5804,
79,
718,
285,
15288,
797,
286,
7457,
1539,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_is_implicit_tag() {
for i in 0..16 {
assert!(is_implicit_tag(i as u64))
}
assert!(!is_implicit_tag(16))
} | rust_cleaned_test_functions.jsonl/25678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
62,
30940,
9372,
368,
341,
262,
369,
600,
304,
220,
15,
496,
16,
21,
341,
286,
2060,
10297,
285,
62,
30940,
9372,
1956,
438,
575,
21,
19,
1171,
262,
456,
262,
2060,
0,
3471,
285,
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
] | 2 |
#[test]
fn test_initialize_vote_account() {
let vote_account_pubkey = solana_sdk::pubkey::new_rand();
let vote_account = AccountSharedData::new_ref(100, VoteState::size_of(), &id());
let vote_account = KeyedAccount::new(&vote_account_pubkey, false, &vote_account);
let node_pubkey = solana_sdk::pubkey::new_rand();
let node_account = RefCell::new(AccountSharedData::default());
let keyed_accounts = &[];
let signers: HashSet<Pubkey> = get_signers(keyed_accounts);
let res = initialize_account(
&vote_account,
&VoteInit {
node_pubkey,
authorized_voter: vote_account_pubkey,
authorized_withdrawer: vote_account_pubkey,
commission: 0,
},
&signers,
&Clock::default(),
true,
);
assert_eq!(res, Err(InstructionError::MissingRequiredSignature));
let keyed_accounts = &[KeyedAccount::new(&node_pubkey, true, &node_account)];
let signers: HashSet<Pubkey> = get_signers(keyed_accounts);
//init should pass
let res = initialize_account(
&vote_account,
&VoteInit {
node_pubkey,
authorized_voter: vote_account_pubkey,
authorized_withdrawer: vote_account_pubkey,
commission: 0,
},
&signers,
&Clock::default(),
true,
);
assert_eq!(res, Ok(()));
// reinit should fail
let res = initialize_account(
&vote_account,
&VoteInit {
node_pubkey,
authorized_voter: vote_account_pubkey,
authorized_withdrawer: vote_account_pubkey,
commission: 0,
},
&signers,
&Clock::default(),
true,
);
assert_eq!(res, Err(InstructionError::AccountAlreadyInitialized));
let large_vote_account = AccountSharedData::new_ref(100, 2 * VoteState::size_of(), &id());
let large_vote_account =
KeyedAccount::new(&vote_account_pubkey, false, &large_vote_account);
let res = initialize_account(
&large_vote_account,
&VoteInit {
node_pubkey,
authorized_voter: vote_account_pubkey,
authorized_withdrawer: vote_account_pubkey,
commission: 0,
},
&signers,
&Clock::default(),
true,
);
assert_eq!(res, Err(InstructionError::InvalidAccountData));
} | rust_cleaned_test_functions.jsonl/75705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40889,
54360,
13500,
368,
341,
286,
1077,
6910,
13500,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
6910,
13500,
284,
8615,
16997,
1043,
486,
931,
7793,
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_display_indent_schema() {
let plan = display_plan();
let expected = "Projection: #employee_csv.id [id:Int32]\
\n Filter: #employee_csv.state = Utf8(\"CO\") [id:Int32, state:Utf8]\
\n TableScan: employee_csv projection=Some([0, 3]) [id:Int32, state:Utf8]";
assert_eq!(expected, format!("{}", plan.display_indent_schema()));
} | rust_cleaned_test_functions.jsonl/29894 | {
"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,
14825,
69045,
25371,
368,
341,
286,
1077,
3119,
284,
3037,
26564,
1428,
286,
1077,
3601,
284,
330,
46321,
25,
671,
12946,
14020,
1764,
508,
307,
43979,
18,
17,
60,
5661,
664,
1124,
77,
220,
1233... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_up_to_date() {
let previous_ents = vec![new_entry(1, 1), new_entry(2, 2), new_entry(3, 3)];
let store = MemStorage::new();
let mut raft_log = RaftLog::new(store, default_logger());
raft_log.append(&previous_ents);
let tests = vec![
(raft_log.last_index() - 1, 4, true),
(raft_log.last_index(), 4, true),
(raft_log.last_index() + 1, 4, true),
(raft_log.last_index() - 1, 2, false),
(raft_log.last_index(), 2, false),
(raft_log.last_index() + 1, 2, false),
(raft_log.last_index() - 1, 3, false),
(raft_log.last_index(), 3, true),
(raft_log.last_index() + 1, 3, true),
];
for (i, &(last_index, term, up_to_date)) in tests.iter().enumerate() {
let g_up_to_date = raft_log.is_up_to_date(last_index, term);
if g_up_to_date != up_to_date {
panic!("#{}: uptodate = {}, want {}", i, g_up_to_date, up_to_date);
}
}
} | rust_cleaned_test_functions.jsonl/48406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 607
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
8237,
2346,
4164,
368,
341,
286,
1077,
3681,
62,
805,
284,
7486,
20703,
931,
9078,
7,
16,
11,
220,
16,
701,
501,
9078,
7,
17,
11,
220,
17,
701,
501,
9078,
7,
18,
11,
220,
18,
12587,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cache_manipulation() -> anyhow::Result<()> {
env_logger::try_init().ok();
let tmp_dir = TempDir::new("AS_CACHE_TEST")?;
let test_data_dir_orig = Path::new("../../test_data");
let test_data_dir = tmp_dir.path().join("test_data");
copy(&test_data_dir_orig, tmp_dir.path(), &CopyOptions::default())?;
let info_file = test_data_dir.join("usak/kulisak/desc.txt");
assert!(info_file.exists());
let db_path = tmp_dir.path().join("updater_db");
let col = CollectionCache::new(&test_data_dir, db_path, FolderLister::new(), false)
.expect("Cannot create CollectionCache");
col.force_update("usak/kulisak")?;
let af = col.get("usak/kulisak").expect("cache record exits");
let ts1 = af.modified.unwrap();
assert_eq!(
Path::new("usak/kulisak/desc.txt"),
af.description.unwrap().path
);
let new_info_name = test_data_dir.join("usak/kulisak/info.txt");
fs::rename(info_file, new_info_name)?;
let af2 = col.list_dir("usak/kulisak", FoldersOrdering::RecentFirst, None)?;
assert_eq!(
Path::new("usak/kulisak/info.txt"),
af2.description.unwrap().path
);
assert!(af2.modified.unwrap() >= ts1);
Ok(())
} | rust_cleaned_test_functions.jsonl/13250 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 646
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11529,
17062,
573,
2914,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
6105,
27413,
486,
1539,
6137,
1005,
562,
543,
286,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
445,
1911,
29138,
11641,
899... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_write_sst() {
let mut meta = SstMeta::default();
meta.set_uuid(Uuid::new_v4().as_bytes().to_vec());
let importer_dir = tempfile::tempdir().unwrap();
let importer = SSTImporter::new(&importer_dir, None).unwrap();
let db_path = importer_dir.path().join("db");
let db = new_test_engine(db_path.to_str().unwrap(), DATA_CFS);
let mut w = importer.new_writer::<TestEngine>(&db, meta).unwrap();
let mut batch = WriteBatch::default();
let mut pairs = vec![];
// put short value kv in wirte cf
let mut pair = Pair::default();
pair.set_key(b"k1".to_vec());
pair.set_value(b"short_value".to_vec());
pairs.push(pair);
// put big value kv in default cf
let big_value = vec![42; 256];
let mut pair = Pair::default();
pair.set_key(b"k2".to_vec());
pair.set_value(big_value);
pairs.push(pair);
// put delete type key in write cf
let mut pair = Pair::default();
pair.set_key(b"k3".to_vec());
pair.set_op(PairOp::Delete);
pairs.push(pair);
// generate two cf metas
batch.set_commit_ts(10);
batch.set_pairs(pairs.into());
w.write(batch).unwrap();
assert_eq!(w.write_entries, 3);
assert_eq!(w.default_entries, 1);
let metas = w.finish().unwrap();
assert_eq!(metas.len(), 2);
} | rust_cleaned_test_functions.jsonl/4972 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 694
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
643,
267,
368,
341,
286,
1077,
5206,
8823,
284,
328,
267,
12175,
486,
2258,
543,
286,
8823,
980,
25540,
12317,
2423,
486,
931,
2273,
19,
1005,
300,
12524,
1005,
983,
13251,
5231,
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_optimize_switch3() {
test(
concat!(
"switch (1) {",
" case 1:",
" case 2:",
" case 3: {",
" break;",
" }",
" case 4:",
" case 5:",
" case 6:",
" default:",
" fail('Should not get here');",
" break;",
"}",
),
"",
);
} | rust_cleaned_test_functions.jsonl/395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15032,
11853,
27652,
18,
368,
341,
262,
1273,
1006,
286,
33720,
33673,
310,
330,
17338,
320,
16,
8,
314,
756,
310,
330,
220,
1142,
220,
16,
55120,
310,
330,
220,
1142,
220,
17,
55120,
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 |
#[test]
fn test_compile_failure() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("jj")?;
let assert = cmd.arg("}").assert();
assert.failure().code(3).stdout("");
Ok(())
} | rust_cleaned_test_functions.jsonl/43235 | {
"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,
74170,
43618,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
5206,
5439,
284,
7348,
486,
66715,
21816,
445,
38811,
899,
37445,
262,
1077,
2060,
284,
5439,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_bank_forks_new_from_banks() {
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let bank = Arc::new(Bank::new(&genesis_config));
let child_bank = Arc::new(Bank::new_from_parent(&bank, &Pubkey::default(), 1));
let bank_forks = BankForks::new_from_banks(&[bank.clone(), child_bank.clone()], 0);
assert_eq!(bank_forks.root(), 0);
assert_eq!(bank_forks.working_bank().slot(), 1);
let bank_forks = BankForks::new_from_banks(&[child_bank, bank], 0);
assert_eq!(bank_forks.root(), 0);
assert_eq!(bank_forks.working_bank().slot(), 1);
} | rust_cleaned_test_functions.jsonl/30576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
761,
73302,
5921,
5673,
880,
4039,
368,
341,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
62,
15,
15,
15,
317,
286,
1077,
607... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_x2_plus_y2() {
let mut register = GearRegister::init();
let squared = squared_gear_template(&mut register);
let mut compound = GearCompound::new(&mut register, 1, 1);
let squared_x = register.instantiate(squared);
let squared_y = register.instantiate(squared);
let add = register.instantiate(register.internal.math_gears.add);
compound.connect(compound.input_id, 0, squared_x, 0);
compound.connect(compound.input_id, 1, squared_y, 0);
compound.connect(squared_x, 0, add, 0);
compound.connect(squared_y, 0, add, 1);
compound.connect(add, 0, compound.output_id, 0);
let gear = register
.builder(compound.into())
.name(String::from("x² + y² = z²"))
.input(IOInformation::new(
String::from("x"),
TypedValue::U64(Default::default()).ty(),
))
.input(IOInformation::new(
String::from("y"),
TypedValue::U64(Default::default()).ty(),
))
.output(IOInformation::new(
String::from("z²"),
TypedValue::U64(Default::default()).ty(),
))
.instantiate();
assert_eq!(
register
.evaluate(gear, vec![TypedValue::U64(4), TypedValue::U64(6)])
.unwrap()[0],
TypedValue::U64(52)
);
} | rust_cleaned_test_functions.jsonl/98618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3212,
17,
28043,
4178,
17,
368,
341,
286,
1077,
5206,
4161,
284,
27503,
8690,
486,
2327,
543,
286,
1077,
52263,
284,
52263,
1889,
682,
8693,
2099,
6984,
4161,
626,
286,
1077,
5206,
23628,
284,
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_dir_type() {
let tmp_dir = tempdir().expect("failed to create temp dir");
let meta =
Meta::from_path(&tmp_dir.path().to_path_buf()).expect("failed to get tempdir path");
let metadata = tmp_dir.path().metadata().expect("failed to get metas");
let colors = Colors::new(Theme::NoLscolors);
let file_type = FileType::new(&metadata, &meta.permissions);
assert_eq!(Colour::Fixed(4).paint("d"), file_type.render(&colors));
} | rust_cleaned_test_functions.jsonl/63557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4334,
1819,
368,
341,
286,
1077,
4174,
4334,
284,
2730,
3741,
1005,
17119,
445,
16091,
311,
1855,
2730,
5419,
797,
286,
1077,
8823,
4035,
310,
15819,
486,
1499,
2638,
2099,
5173,
4334,
3875,
1005,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_program_upgradeable_locks() {
fn setup_program_upgradeable_locks(
payer_keypair: &Keypair,
buffer_keypair: &Keypair,
program_keypair: &Keypair,
) -> (Arc<Bank>, Transaction, Transaction) {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(2_000_000_000);
let mut bank = Bank::new_for_tests(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_upgradeable_program!();
bank.add_builtin(&name, &id, entrypoint);
let bank = Arc::new(bank);
let bank_client = BankClient::new_shared(&bank);
load_upgradeable_bpf_program(
&bank_client,
&mint_keypair,
buffer_keypair,
program_keypair,
payer_keypair,
"solana_bpf_rust_panic",
);
// Load the buffer account
let path = create_bpf_path("solana_bpf_rust_noop");
let mut file = File::open(&path).unwrap_or_else(|err| {
panic!("Failed to open {}: {}", path.display(), err);
});
let mut elf = Vec::new();
file.read_to_end(&mut elf).unwrap();
load_buffer_account(
&bank_client,
&mint_keypair,
buffer_keypair,
&payer_keypair,
&elf,
);
bank_client
.send_and_confirm_instruction(
&mint_keypair,
system_instruction::transfer(
&mint_keypair.pubkey(),
&payer_keypair.pubkey(),
1_000_000_000,
),
)
.unwrap();
let invoke_tx = Transaction::new(
&[payer_keypair],
Message::new(
&[Instruction::new_with_bytes(
program_keypair.pubkey(),
&[0; 0],
vec![],
)],
Some(&payer_keypair.pubkey()),
),
bank.last_blockhash(),
);
let upgrade_tx = Transaction::new(
&[payer_keypair],
Message::new(
&[bpf_loader_upgradeable::upgrade(
&program_keypair.pubkey(),
&buffer_keypair.pubkey(),
&payer_keypair.pubkey(),
&payer_keypair.pubkey(),
)],
Some(&payer_keypair.pubkey()),
),
bank.last_blockhash(),
);
(bank, invoke_tx, upgrade_tx)
}
let payer_keypair = keypair_from_seed(&[56u8; 32]).unwrap();
let buffer_keypair = keypair_from_seed(&[11; 32]).unwrap();
let program_keypair = keypair_from_seed(&[77u8; 32]).unwrap();
let results1 = {
let (bank, invoke_tx, upgrade_tx) =
setup_program_upgradeable_locks(&payer_keypair, &buffer_keypair, &program_keypair);
execute_transactions(&bank, vec![upgrade_tx, invoke_tx])
};
let results2 = {
let (bank, invoke_tx, upgrade_tx) =
setup_program_upgradeable_locks(&payer_keypair, &buffer_keypair, &program_keypair);
execute_transactions(&bank, vec![invoke_tx, upgrade_tx])
};
assert!(matches!(
results1[0],
Ok(ConfirmedTransactionWithStatusMeta {
transaction: TransactionWithStatusMeta {
meta: Some(TransactionStatusMeta { status: Ok(()), .. }),
..
},
..
})
));
assert_eq!(results1[1], Err(TransactionError::AccountInUse));
assert!(matches!(
results2[0],
Ok(ConfirmedTransactionWithStatusMeta {
transaction: TransactionWithStatusMeta {
meta: Some(TransactionStatusMeta {
status: Err(TransactionError::InstructionError(
0,
InstructionError::ProgramFailedToComplete
)),
..
}),
..
},
..
})
));
assert_eq!(results2[1], Err(TransactionError::AccountInUse));
} | rust_cleaned_test_functions.jsonl/8842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
67794,
480,
9818,
82,
368,
341,
262,
5168,
6505,
25096,
67794,
480,
9818,
82,
1006,
286,
69275,
3097,
12670,
25,
609,
6608,
1082,
1310,
345,
286,
4147,
3097,
12670,
25,
609,
6608,
1082,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_reader_error() {
let empty: &[u8] = &[];
let res = create_reader(1024, empty);
assert!(res.is_err());
if let Err(err) = res {
assert_eq!(err, PcapError::Eof);
} else {
unreachable!();
}
} | rust_cleaned_test_functions.jsonl/7712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
22306,
4096,
368,
341,
262,
1077,
4287,
25,
44590,
84,
23,
60,
284,
609,
15078,
262,
1077,
592,
284,
1855,
22306,
7,
16,
15,
17,
19,
11,
4287,
317,
262,
2060,
10297,
416,
2079,
9266,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_is_deployment_synced() {
let block_0 = BlockPtr::try_from((
"bd34884280958002c51d3f7b5f853e6febeba33de0f40d15b0363006533c924f",
0,
))
.unwrap();
let block_1 = BlockPtr::try_from((
"8511fa04b64657581e3f00e14543c1d522d5d7e771b54aa3060b662ade47da13",
1,
))
.unwrap();
let block_2 = BlockPtr::try_from((
"b98fb783b49de5652097a989414c767824dff7e7fd765a63b493772511db81c1",
2,
))
.unwrap();
assert!(!is_deployment_synced(&block_0, None));
assert!(!is_deployment_synced(&block_2, None));
assert!(!is_deployment_synced(&block_0, Some(block_2.clone())));
assert!(is_deployment_synced(&block_1, Some(block_2.clone())));
assert!(is_deployment_synced(&block_2, Some(block_2.clone())));
} | rust_cleaned_test_functions.jsonl/2775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 422
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
2259,
52799,
23008,
291,
368,
341,
262,
1077,
2504,
62,
15,
284,
8362,
5348,
486,
1539,
5673,
94702,
286,
330,
8940,
18,
19,
23,
23,
19,
17,
23,
15,
24,
20,
23,
15,
15,
17,
66,
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_with_capacity() {
let v: SmallVec<[u8; 3]> = SmallVec::with_capacity(1);
assert!(v.is_empty());
assert!(!v.spilled());
assert_eq!(v.capacity(), 3);
let v: SmallVec<[u8; 3]> = SmallVec::with_capacity(10);
assert!(v.is_empty());
assert!(v.spilled());
assert_eq!(v.capacity(), 10);
} | rust_cleaned_test_functions.jsonl/88145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
35603,
368,
341,
286,
1077,
348,
25,
14994,
10050,
66746,
84,
23,
26,
220,
18,
25669,
284,
14994,
10050,
486,
4197,
35603,
7,
16,
317,
286,
2060,
10297,
85,
2079,
15124,
1423,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_ldrh() {
match decode_16(0x8f00) {
Instruction::LDRH_imm { params, thumb32 } => {
assert!(params.rn == Reg::R0);
assert!(params.rt == Reg::R0);
assert!(params.imm32 == 0x38);
assert!(params.index);
assert!(params.add);
assert!(!params.wback);
assert!(!thumb32);
}
_ => {
assert!(false);
}
}
} | rust_cleaned_test_functions.jsonl/64775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
50573,
40096,
368,
341,
1066,
262,
2432,
16895,
62,
16,
21,
7,
15,
87,
23,
69,
15,
15,
8,
341,
286,
29051,
486,
43,
7687,
39,
71370,
314,
3628,
11,
24050,
18,
17,
335,
589,
341,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_occur_leaf() {
let ((occur, ast), _) = super::occur_leaf().parse("+abc").unwrap();
assert_eq!(occur, Some(Occur::Must));
assert_eq!(format!("{:?}", ast), "\"abc\"");
} | rust_cleaned_test_functions.jsonl/64409 | {
"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,
49648,
2352,
38909,
368,
341,
286,
1077,
1781,
509,
2352,
11,
11763,
701,
27439,
284,
2256,
486,
509,
2352,
38909,
1005,
6400,
34973,
13683,
1827,
15454,
543,
286,
2060,
10714,
10297,
509,
2352,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_gen_cluster_nodes() {
let m = HashMap::new();
let slot_ranges = gen_testing_slot_ranges("127.0.0.1:5299");
let output = gen_cluster_nodes_helper(
&ClusterName::try_from("testcluster").unwrap(),
233,
&slot_ranges,
&m,
true,
);
assert_eq!(output, "testcluster_________9f8fca2805923328____ 127.0.0.1:5299 myself,master - 0 0 233 connected 0-100 300\n");
} | rust_cleaned_test_functions.jsonl/79228 | {
"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,
16322,
28441,
14896,
368,
341,
286,
1077,
296,
284,
10528,
486,
931,
543,
286,
1077,
9446,
58748,
284,
4081,
70962,
27563,
58748,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
20,
17,
24,
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_json_option_statement() {
let n = OptionStmt {
base: BaseNode::default(),
assignment: Assignment::Variable(Box::new(VariableAssgn {
base: BaseNode::default(),
id: Identifier {
base: BaseNode::default(),
name: "task".to_string(),
},
init: Expression::Object(Box::new(ObjectExpr {
base: BaseNode::default(),
with: None,
properties: vec![
Property {
base: BaseNode::default(),
key: PropertyKey::Identifier(Identifier {
base: BaseNode::default(),
name: "name".to_string(),
}),
value: Some(Expression::StringLit(StringLit {
base: Default::default(),
value: "foo".to_string(),
})),
},
Property {
base: BaseNode::default(),
key: PropertyKey::Identifier(Identifier {
base: BaseNode::default(),
name: "every".to_string(),
}),
value: Some(Expression::Duration(DurationLit {
base: Default::default(),
values: vec![Duration {
magnitude: 1,
unit: "h".to_string(),
}],
})),
},
],
})),
})),
};
let serialized = serde_json::to_string(&n).unwrap();
assert_eq!(
serialized,
r#"{"type":"OptionStatement","assignment":{"type":"VariableAssignment","id":{"type":"Identifier","name":"task"},"init":{"type":"ObjectExpression","properties":[{"type":"Property","key":{"type":"Identifier","name":"name"},"value":{"type":"StringLiteral","value":"foo"}},{"type":"Property","key":{"type":"Identifier","name":"every"},"value":{"type":"DurationLiteral","values":[{"magnitude":1,"unit":"h"}]}}]}}}"#
);
let deserialized: OptionStmt = serde_json::from_str(serialized.as_str()).unwrap();
assert_eq!(deserialized, n)
} | rust_cleaned_test_functions.jsonl/40420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
9672,
37404,
368,
341,
262,
1077,
308,
284,
6959,
31063,
341,
286,
2331,
25,
5351,
1955,
486,
2258,
3148,
286,
16319,
25,
34427,
486,
7827,
67758,
486,
931,
7,
7827,
5615,
4905,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drop() {
let local = ThreadLocal::new();
struct Dropped(Arc<AtomicUsize>);
impl Drop for Dropped {
fn drop(&mut self) {
self.0.fetch_add(1, Relaxed);
}
}
let dropped = Arc::new(AtomicUsize::new(0));
local.get_or(|| Dropped(dropped.clone()));
assert_eq!(dropped.load(Relaxed), 0);
drop(local);
assert_eq!(dropped.load(Relaxed), 1);
} | rust_cleaned_test_functions.jsonl/47815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
368,
341,
286,
1077,
2205,
284,
8752,
7319,
486,
931,
543,
286,
2036,
422,
41716,
4346,
1287,
27,
65857,
52,
2141,
42013,
286,
11605,
15733,
369,
422,
41716,
341,
310,
5168,
5943,
2099,
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_push_head() {
let mut ll = LinkedList::<u8>::new();
let node = ll.push_head(11);
assert_node!(ll, node, ONLY, 11, 1);
//now push a second head
let second = ll.push_head(12);
assert_node!(ll, second, FIRST, 12, 2);
assert_node!(ll, node, LAST, 11, 2);
assert_order!(ll, second, 12, node, 11);
//now push a third node
let third = ll.push_head(13);
assert_node!(ll, third, FIRST, 13, 3);
assert_node!(ll, second, MIDDLE, 12, 3);
assert_node!(ll, node, LAST, 11, 3);
assert_order!(ll, third, 13, second, 12);
assert_order!(ll, second, 12, node, 11);
ll.clear();
assert_empty!(ll);
} | rust_cleaned_test_functions.jsonl/59882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
13138,
368,
341,
286,
1077,
5206,
9323,
284,
22917,
27638,
84,
23,
6831,
931,
543,
286,
1077,
2436,
284,
9323,
2552,
13138,
7,
16,
16,
317,
286,
2060,
5084,
10297,
654,
11,
2436,
11,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_minute() {
assert_eq!(minute("minutes"), Ok(("", "minutes")));
assert_eq!(minute("minute"), Ok(("", "minute")));
assert_eq!(minute("mins"), Ok(("", "mins")));
assert_eq!(minute("min"), Ok(("", "min")));
} | rust_cleaned_test_functions.jsonl/71143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76944,
368,
341,
310,
2060,
10714,
10297,
42557,
445,
37037,
3975,
7622,
7,
19814,
330,
37037,
17621,
310,
2060,
10714,
10297,
42557,
445,
42557,
3975,
7622,
7,
19814,
330,
42557,
17621,
310,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_0232() {
let mut queue = MyQueue::new();
queue.push(1);
queue.push(2);
assert_eq!(1, queue.peek());
assert_eq!(1, queue.pop());
assert!(!queue.empty());
assert_eq!(2, queue.peek());
assert_eq!(2, queue.pop());
assert!(queue.empty());
} | rust_cleaned_test_functions.jsonl/16467 | {
"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,
62,
15,
17,
18,
17,
368,
341,
286,
1077,
5206,
7177,
284,
3017,
7554,
486,
931,
543,
286,
7177,
2552,
7,
16,
317,
286,
7177,
2552,
7,
17,
317,
286,
2060,
10714,
10297,
16,
11,
7177,
41249,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_guild_widget() {
let route = Route::UpdateGuildWidget { guild_id: GUILD_ID };
assert_eq!(
route.to_string(),
format!("guilds/{guild_id}/widget", guild_id = GUILD_ID)
);
} | rust_cleaned_test_functions.jsonl/119943 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
1889,
1498,
13585,
368,
341,
286,
1077,
6021,
284,
9572,
486,
4289,
72574,
4548,
314,
26411,
842,
25,
479,
18023,
3450,
2605,
286,
2060,
10714,
33673,
310,
6021,
2389,
3904,
3148,
310,
3561,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_append_raw() {
let mut headers = Headers::new();
headers.set(ContentLength(10));
headers.append_raw("content-LENGTH", b"20".to_vec());
assert_eq!(headers.get_raw("Content-length").unwrap(), &[b"10".to_vec(), b"20".to_vec()][..]);
headers.append_raw("x-foo", "bar");
assert_eq!(headers.get_raw("x-foo").unwrap(), &[b"bar".to_vec()][..]);
} | rust_cleaned_test_functions.jsonl/108103 | {
"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,
26041,
16067,
368,
341,
286,
1077,
5206,
7102,
284,
21426,
486,
931,
543,
286,
7102,
980,
79352,
4373,
7,
16,
15,
1106,
286,
7102,
2057,
16067,
445,
1796,
12,
65981,
497,
293,
1,
17,
15,
3263,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pub_sub_2_clients() {
env_logger::init();
let server = NatsTestServer::build().spawn();
let conn1 = nats - aflowt::connect(&server.address().to_string()).unwrap();
let conn2 = nats - aflowt::connect(&server.address().to_string()).unwrap();
let sub = conn1.subscribe("*").unwrap();
conn2.publish("subject", "message").unwrap();
sub.next_timeout(Duration::from_millis(100)).unwrap();
} | rust_cleaned_test_functions.jsonl/102469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
5228,
62,
17,
56899,
368,
341,
262,
6105,
27413,
486,
2327,
543,
262,
1077,
3538,
284,
451,
1862,
2271,
5475,
486,
5834,
1005,
46087,
1428,
262,
1077,
4534,
16,
284,
308,
1862,
481,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lowest_index_const() {
for i in 1..255 {
let input = (i as ValueType + 56.0) / 16.3251;
let mut method = LowestIndex::new(i, &input).unwrap();
let output = method.next(&input);
test_const(&mut method, &input, &output);
}
} | rust_cleaned_test_functions.jsonl/15553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23767,
477,
3560,
13610,
368,
341,
197,
2023,
600,
304,
220,
16,
496,
17,
20,
20,
341,
298,
10217,
1946,
284,
320,
72,
438,
55545,
488,
220,
20,
21,
13,
15,
8,
608,
220,
16,
21,
13,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_type_inference() {
expr_type!(expr!(Int 12), types!(Int));
expr_type!(expr!(Let n [Int 12] [Var n]), types!(Int));
expr_type!(
expr!(Let f [Abs x [Var x]] [Var f]),
types!(Fun, types!(Var, a1), types!(Var, a1))
);
expr_type!(
expr!(Let x [Abs x [Var x]] [App [Var x] [Var x]]),
types!(Fun, types!(Var, a3), types!(Var, a3))
);
expr_type!(
expr!(
Let
length
[Abs xs [Int 12]]
[App [Var length] [Var length]]
),
types!(Int)
);
expr_type!(expr!(If [Bool true] [Int 12] [Int 61]), types!(Int));
expr_type!(expr!(If [Bool false] [Int 12] [Int 61]), types!(Int));
expr_type!(
expr!(If [Let b [Bool true] [Var b]] [Int 12] [Int 61]),
types!(Int)
);
expr_type!(
expr!(
Let
f
[
If
[Bool true]
[Abs n [Bool false]]
[Abs n [Bool true]]
]
[App [Var f] [Int 61]]
),
types!(Bool)
);
expr_type!(
expr!(If [Bool true] [Abs n [Int 42]] [Abs q [Int 21]]),
types!(Fun, types!(Var, a1), types!(Int))
);
expr_type!(
expr!(List [Int 12] [List [Int 24] [Nil]]),
types!(List, types!(Int))
);
expr_type!(
expr!(List [Bool true] [List [Bool false] [Nil]]),
types!(List, types!(Bool))
);
expr_type!(
expr!(
Let
b
[
If
[Bool false]
[Bool true]
[
App
[
Abs
n
[Bool false]
]
[Int 42]
]
]
[List [Bool true] [List [Var b] [Nil]]]
),
types!(List, types!(Bool))
);
} | rust_cleaned_test_functions.jsonl/125817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1536
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
1243,
2202,
368,
341,
286,
15169,
1819,
10297,
9413,
10297,
1072,
220,
16,
17,
701,
4494,
10297,
1072,
3237,
286,
15169,
1819,
10297,
9413,
10297,
10061,
308,
508,
1072,
220,
16,
17,
60,
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_row_is_empty() {
let table = Table::find_first(TABLE_TD).unwrap();
assert_eq!(
vec![false],
table.iter().map(|r| r.is_empty()).collect::<Vec<_>>()
);
let table = Table::find_first(TABLE_COMPLEX).unwrap();
assert_eq!(
vec![false, false, true, false],
table.iter().map(|r| r.is_empty()).collect::<Vec<_>>()
);
} | rust_cleaned_test_functions.jsonl/47590 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
6892,
15124,
368,
341,
286,
1077,
1965,
284,
6633,
486,
3903,
12978,
83006,
95862,
568,
15454,
543,
286,
2060,
10714,
33673,
310,
7486,
20703,
3849,
1259,
310,
1965,
19471,
1005,
2186,
22428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compile_with_dups() {
let program_id0 = Pubkey::new_unique();
let program_id1 = Pubkey::new_unique();
let program_id2 = Pubkey::new_unique();
let program_id3 = Pubkey::new_unique();
let id0 = Pubkey::new_unique();
let id1 = Pubkey::new_unique();
let id2 = Pubkey::new_unique();
let id3 = Pubkey::new_unique();
let compiled_keys = CompiledKeys::compile(
&[
Instruction::new_with_bincode(
program_id0,
&0,
vec![
AccountMeta::new_readonly(id0, false),
AccountMeta::new_readonly(id1, true),
AccountMeta::new(id2, false),
AccountMeta::new(id3, true),
// duplicate the account inputs
AccountMeta::new_readonly(id0, false),
AccountMeta::new_readonly(id1, true),
AccountMeta::new(id2, false),
AccountMeta::new(id3, true),
// reference program ids
AccountMeta::new_readonly(program_id0, false),
AccountMeta::new_readonly(program_id1, true),
AccountMeta::new(program_id2, false),
AccountMeta::new(program_id3, true),
],
),
Instruction::new_with_bincode(program_id1, &0, vec![]),
Instruction::new_with_bincode(program_id2, &0, vec![]),
Instruction::new_with_bincode(program_id3, &0, vec![]),
],
None,
);
assert_eq!(
compiled_keys,
CompiledKeys {
payer: None,
key_meta_map: BTreeMap::from([
(id0, KeyFlags::empty().into()),
(id1, KeyFlags::SIGNER.into()),
(id2, KeyFlags::WRITABLE.into()),
(id3, (KeyFlags::SIGNER | KeyFlags::WRITABLE).into()),
(program_id0, KeyFlags::INVOKED.into()),
(program_id1, (KeyFlags::INVOKED | KeyFlags::SIGNER).into()),
(program_id2, (KeyFlags::INVOKED | KeyFlags::WRITABLE).into()),
(program_id3, KeyFlags::all().into()),
]),
}
);
} | rust_cleaned_test_functions.jsonl/52061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
6615,
814,
8602,
368,
341,
286,
1077,
2025,
842,
15,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
2025,
842,
16,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
2025,
842,
17,
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_partial_order() {
// Small test
assert_order(&[1], &[1], Some(Ordering::Equal));
assert_order(&[1], &[2], Some(Ordering::Less));
assert_order(&[2], &[1], Some(Ordering::Greater));
assert_order(&[1], &[1, 2], Some(Ordering::Less));
assert_order(&[2], &[1, 2], None);
// Misc tests
assert_order(&[400], &[0, 1], None);
// Large test
assert_order(
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0],
Some(Ordering::Equal),
);
assert_order(
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 0],
Some(Ordering::Less),
);
assert_order(
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11],
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0],
Some(Ordering::Greater),
);
assert_order(
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11],
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 0],
None,
);
assert_order(
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9],
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0],
Some(Ordering::Less),
);
assert_order(
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9],
&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 0],
Some(Ordering::Less),
);
} | rust_cleaned_test_functions.jsonl/36463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 916
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
7869,
368,
341,
286,
442,
14994,
1273,
198,
286,
2060,
7869,
2099,
58,
16,
1125,
44590,
16,
1125,
4329,
39692,
287,
486,
2993,
1106,
286,
2060,
7869,
2099,
58,
16,
1125,
44590,
17,
1125,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_shader_macro() {
let map = load_shaders!(vec!["foo", "bar"], Test);
assert_eq!(&map["foo"].key, "foo");
assert_eq!(&map["bar"].key, "bar");
} | rust_cleaned_test_functions.jsonl/91740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
35485,
58810,
368,
341,
286,
1077,
2415,
284,
2795,
3712,
6393,
10297,
4083,
0,
1183,
7975,
497,
330,
2257,
7914,
3393,
317,
286,
2060,
10714,
0,
2099,
2186,
1183,
7975,
5521,
792,
11,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_payload_incorrect_deserialize() {
// Payload from old anchoring transaction
let payload_script = Script::from_hex(
"6a2a0128f0b31a00000000008fb4879f1b7f332be1aee197f99f\
7333c915570c6ad5c6eed641f33fe0199129",
);
assert_eq!(Payload::from_script(&payload_script), None);
} | rust_cleaned_test_functions.jsonl/119539 | {
"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,
32813,
1243,
19928,
15768,
9050,
368,
341,
286,
442,
52916,
504,
2310,
33230,
5503,
7745,
198,
286,
1077,
7729,
14660,
284,
13710,
486,
1499,
32655,
1006,
310,
330,
21,
64,
17,
64,
15,
16,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_file_to_string() -> Result<(), String> {
let buffer = read_file_to_string("test.md");
assert_eq!(buffer, "This file is just for test purposes");
Ok(())
} | rust_cleaned_test_functions.jsonl/116430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2458,
2346,
3904,
368,
1464,
5714,
68843,
923,
29,
341,
286,
1077,
4147,
284,
1349,
2458,
2346,
3904,
445,
1944,
21324,
3071,
286,
2060,
10714,
10297,
7573,
11,
330,
1986,
1034,
374,
1101,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_storage_cache_update() {
let ents = vec![new_entry(3, 3), new_entry(4, 4), new_entry(5, 5)];
let td = Builder::new().prefix("tikv-store-test").tempdir().unwrap();
let worker = Worker::new("snap-manager");
let sched = worker.scheduler();
let mut store = new_storage_from_ents(sched, &td, &ents);
store.cache.cache.clear();
// initial cache
let mut entries = vec![new_entry(6, 5), new_entry(7, 5)];
append_ents(&mut store, &entries);
validate_cache(&store, &entries);
// rewrite
entries = vec![new_entry(6, 6), new_entry(7, 6)];
append_ents(&mut store, &entries);
validate_cache(&store, &entries);
// rewrite old entry
entries = vec![new_entry(5, 6), new_entry(6, 6)];
append_ents(&mut store, &entries);
validate_cache(&store, &entries);
// partial rewrite
entries = vec![new_entry(6, 7), new_entry(7, 7)];
append_ents(&mut store, &entries);
let mut exp_res = vec![new_entry(5, 6), new_entry(6, 7), new_entry(7, 7)];
validate_cache(&store, &exp_res);
// direct append
entries = vec![new_entry(8, 7), new_entry(9, 7)];
append_ents(&mut store, &entries);
exp_res.extend_from_slice(&entries);
validate_cache(&store, &exp_res);
// rewrite middle
entries = vec![new_entry(7, 8)];
append_ents(&mut store, &entries);
exp_res.truncate(2);
exp_res.push(new_entry(7, 8));
validate_cache(&store, &exp_res);
let cap = MAX_CACHE_CAPACITY as u64;
// result overflow
entries = (3..=cap).map(|i| new_entry(i + 5, 8)).collect();
append_ents(&mut store, &entries);
exp_res.remove(0);
exp_res.extend_from_slice(&entries);
validate_cache(&store, &exp_res);
// input overflow
entries = (0..=cap).map(|i| new_entry(i + cap + 6, 8)).collect();
append_ents(&mut store, &entries);
exp_res = entries[entries.len() - cap as usize..].to_vec();
validate_cache(&store, &exp_res);
// compact
store.compact_to(cap + 10);
exp_res = (cap + 10..cap * 2 + 7).map(|i| new_entry(i, 8)).collect();
validate_cache(&store, &exp_res);
// compact shrink
assert!(store.cache.cache.capacity() >= cap as usize);
store.compact_to(cap * 2);
exp_res = (cap * 2..cap * 2 + 7).map(|i| new_entry(i, 8)).collect();
validate_cache(&store, &exp_res);
assert!(store.cache.cache.capacity() < cap as usize);
// append shrink
entries = (0..=cap).map(|i| new_entry(i, 8)).collect();
append_ents(&mut store, &entries);
assert!(store.cache.cache.capacity() >= cap as usize);
append_ents(&mut store, &[new_entry(6, 8)]);
exp_res = (1..7).map(|i| new_entry(i, 8)).collect();
validate_cache(&store, &exp_res);
assert!(store.cache.cache.capacity() < cap as usize);
// compact all
store.compact_to(cap + 2);
validate_cache(&store, &[]);
// invalid compaction should be ignored.
store.compact_to(cap);
} | rust_cleaned_test_functions.jsonl/3773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1496
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
11529,
8882,
368,
341,
286,
1077,
36852,
284,
7486,
20703,
931,
9078,
7,
18,
11,
220,
18,
701,
501,
9078,
7,
19,
11,
220,
19,
701,
501,
9078,
7,
20,
11,
220,
20,
12587,
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... | 1 |
#[test]
fn test_intersects_with() {
let mut file1 = new_file("9-19\n");
let mut set1 = parse_cpus_from_sysfile(&mut file1).expect("Failed to file");
assert_eq!(set1, (9..=19).collect());
let mut file2 = new_file("16-24\n");
let set2 = parse_cpus_from_sysfile(&mut file2).expect("Failed to file");
assert_eq!(set2, (16..=24).collect());
set1 = set1.intersection(&set2).map(|x| *x).collect();
assert_eq!(set1, (16..=19).collect());
} | rust_cleaned_test_functions.jsonl/109214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15318,
54429,
6615,
368,
341,
286,
1077,
5206,
1034,
16,
284,
501,
2458,
445,
24,
12,
16,
24,
1699,
797,
286,
1077,
5206,
738,
16,
284,
4715,
90673,
5673,
20344,
1192,
2099,
6984,
1034,
16,
56... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_columns() {
// the doctest
let text = [
"I am aligned to the left.",
"I am aligned to the right and take two times more space.",
];
let layout = Layout::from_pattern("<- >--").unwrap();
let expected_none = String::from("I am I am aligned to the\naligned to right and take two\nthe left. times more space.");
let expected_between = String::from("I am I am aligned to the\naligned to right and take two\nthe left. times more space.");
let expected_around = String::from(" I am I am aligned to the\n aligned to right and take two\n the left. times more space.");
assert_eq!(columns(text, Spacing::NONE, &layout, 30), expected_none);
assert_eq!(
columns(text, Spacing::BETWEEN, &layout, 31),
expected_between
);
assert_eq!(columns(text, Spacing::AROUND, &layout, 33), expected_around);
} | rust_cleaned_test_functions.jsonl/42143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22590,
368,
341,
262,
442,
279,
653,
67880,
198,
262,
1077,
1467,
284,
2278,
286,
330,
40,
1079,
26118,
311,
279,
2115,
10346,
286,
330,
40,
1079,
26118,
311,
279,
1290,
323,
1896,
1378,
3039,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_negative_rand_range() {
let mut rng = task_rng();
let l = FromPrimitive::from_uint(2352).unwrap();
let u = FromPrimitive::from_uint(3513).unwrap();
// Switching u and l should fail:
let _n: BigUint = rng.gen_biguint_range(&u, &l);
} | rust_cleaned_test_functions.jsonl/96917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53865,
33864,
9698,
368,
341,
286,
1077,
5206,
28422,
284,
3383,
66849,
543,
286,
1077,
326,
284,
5542,
33313,
486,
1499,
15807,
7,
17,
18,
20,
17,
568,
15454,
543,
286,
1077,
575,
284,
5542,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reverse() {
let mut ys = [1, 2, 3, 4, 5];
ys.mut_iter().reverse_();
assert!(ys == [5, 4, 3, 2, 1]);
} | rust_cleaned_test_functions.jsonl/33842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43277,
368,
341,
286,
1077,
5206,
31810,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
31810,
744,
332,
11723,
1005,
25903,
96060,
286,
2060,
10297,
1047,
621,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_append_and_delete() {
let mut read_buf: [u8; 1024] = [0; 1024];
let mut hash_function = DefaultHasher::new();
MAIN_KEY.hash(&mut hash_function);
let tickv =
AsyncTicKV::<FlashCtrl, 1024>::new(FlashCtrl::new(), &mut read_buf, 0x10000);
let mut ret = tickv.initialise(hash_function.finish());
while ret.is_err() {
let (r, _buf) = tickv.continue_operation();
ret = r;
}
static mut VALUE: [u8; 32] = [0x23; 32];
static mut BUF: [u8; 32] = [0; 32];
println!("Add key ONE");
let ret = unsafe { tickv.append_key(get_hashed_key(b"ONE"), &mut VALUE) };
match ret {
Err((_buf, ErrorCode::ReadNotReady(reg))) => {
tickv.set_read_buffer(&tickv.tickv.controller.buf.borrow()[reg]);
tickv.continue_operation().0.unwrap();
}
Ok(_) => {}
_ => unreachable!(),
}
println!("Get key ONE");
unsafe {
tickv.get_key(get_hashed_key(b"ONE"), &mut BUF).unwrap();
}
println!("Delete Key ONE");
tickv.invalidate_key(get_hashed_key(b"ONE")).unwrap();
println!("Get non-existant key ONE");
unsafe {
match tickv.get_key(get_hashed_key(b"ONE"), &mut BUF) {
Err((_, ErrorCode::KeyNotFound)) => {}
_ => {
panic!("Expected ErrorCode::KeyNotFound");
}
}
}
println!("Try to delete Key ONE Again");
assert_eq!(
tickv.invalidate_key(get_hashed_key(b"ONE")),
Err(ErrorCode::KeyNotFound)
);
} | rust_cleaned_test_functions.jsonl/2690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
8378,
11353,
368,
341,
310,
1077,
5206,
1349,
10363,
25,
508,
84,
23,
26,
220,
16,
15,
17,
19,
60,
284,
508,
15,
26,
220,
16,
15,
17,
19,
935,
310,
1077,
5206,
5175,
9174,
284,
7899... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_section_property_default() {
let c = SectionProperty::new();
let b = c.build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:sectPr><w:pgSz w:w="11906" w:h="16838" /><w:pgMar w:top="1985" w:right="1701" w:bottom="1701" w:left="1701" w:header="851" w:footer="992" w:gutter="0" /><w:cols w:space="425" /><w:docGrid w:type="lines" w:linePitch="360" /></w:sectPr>"#
);
} | rust_cleaned_test_functions.jsonl/31177 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16221,
16638,
9993,
368,
341,
286,
1077,
272,
284,
11113,
3052,
486,
931,
543,
286,
1077,
293,
284,
272,
13239,
543,
286,
2060,
10714,
33673,
310,
607,
486,
1499,
39453,
23,
2099,
65,
568,
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_static_spendable_outputs_justice_tx_revoked_commitment_tx() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
// Create some initial channels
let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let payment_preimage = route_payment(&nodes[0], &vec!(&nodes[1])[..], 3000000).0;
let revoked_local_txn = get_local_commitment_txn!(nodes[0], chan_1.2);
assert_eq!(revoked_local_txn[0].input.len(), 1);
assert_eq!(revoked_local_txn[0].input[0].previous_output.txid, chan_1.3.txid());
claim_payment(&nodes[0], &vec!(&nodes[1])[..], payment_preimage);
mine_transaction(&nodes[1], &revoked_local_txn[0]);
check_closed_broadcast!(nodes[1], true);
check_added_monitors!(nodes[1], 1);
check_closed_event!(nodes[1], 1, ClosureReason::CommitmentTxConfirmed);
let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap();
assert_eq!(node_txn.len(), 2);
assert_eq!(node_txn[0].input.len(), 2);
check_spends!(node_txn[0], revoked_local_txn[0]);
mine_transaction(&nodes[1], &node_txn[0]);
connect_blocks(&nodes[1], ANTI_REORG_DELAY - 1);
let spend_txn = check_spendable_outputs!(nodes[1], node_cfgs[1].keys_manager);
assert_eq!(spend_txn.len(), 1);
check_spends!(spend_txn[0], node_txn[0]);
} | rust_cleaned_test_functions.jsonl/16904 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 631
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25360,
643,
3740,
480,
35189,
62,
38768,
17805,
38082,
10823,
36346,
478,
17805,
368,
341,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
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_load_initrd_no_memory() {
let gm = create_guest_mem_with_size(79);
let image = make_test_bin();
let res = load_initrd(&gm, &mut Cursor::new(&image));
assert!(res.is_err());
assert_eq!(
StartMicrovmError::InitrdLoad.to_string(),
res.err().unwrap().to_string()
);
} | rust_cleaned_test_functions.jsonl/4348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
6137,
6498,
6536,
19195,
368,
341,
286,
1077,
37879,
284,
1855,
62739,
12976,
6615,
2368,
7,
22,
24,
317,
286,
1077,
2168,
284,
1281,
4452,
21816,
543,
286,
1077,
592,
284,
2795,
6137,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_many_with_many_reads() {
let mut mmapped_buf = MMappedBuf {
data: [0; PAGE_SIZE * 2],
};
fake_mmap(&mut mmapped_buf);
let mut buf = PerfBuffer::open(1, PAGE_SIZE, 1).unwrap();
let next = write_sample(&mut mmapped_buf, 0, 0xCAFEBABEu32);
write_sample(&mut mmapped_buf, next, 0xBADCAFEu32);
let mut out_bufs = [BytesMut::with_capacity(4)];
let events = buf.read_events(&mut out_bufs).unwrap();
assert_eq!(events, Events { lost: 0, read: 1 });
assert_eq!(u32_from_buf(&out_bufs[0]), 0xCAFEBABE);
let events = buf.read_events(&mut out_bufs).unwrap();
assert_eq!(events, Events { lost: 0, read: 1 });
assert_eq!(u32_from_buf(&out_bufs[0]), 0xBADCAFE);
} | rust_cleaned_test_functions.jsonl/118764 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
22101,
6615,
22101,
66628,
368,
341,
286,
1077,
5206,
9465,
5677,
10363,
284,
21665,
5677,
15064,
341,
310,
821,
25,
508,
15,
26,
25040,
4098,
353,
220,
17,
1259,
286,
2605,
286,
12418,
71... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_erc20_approval_and_transfer_from() {
// Init virtual machine.
let mut builder = TestBuilder::default();
builder.run_genesis(&DEFAULT_GENESIS_CONFIG).commit();
transfer_motes(&mut builder, ACCOUNT_1, ACCOUNT_2, 100_000_000);
// Deploy token.
let init_balance = U512::from(1000);
let (token_hash, proxy_hash) = deploy_erc20(&mut builder, ACCOUNT_1, TOKEN_NAME, init_balance);
// At start allowance should be 0 tokens.
assert_allowance(
&mut builder,
proxy_hash,
token_hash,
ACCOUNT_1,
ACCOUNT_1,
ACCOUNT_2,
U512::zero(),
);
// ACCOUNT_1 allows ACCOUNT_2 to spend 10 tokens.
let allowance = U512::from(10);
approve(
&mut builder,
proxy_hash,
token_hash,
ACCOUNT_1,
ACCOUNT_2,
allowance,
);
assert_allowance(
&mut builder,
proxy_hash,
token_hash,
ACCOUNT_1,
ACCOUNT_1,
ACCOUNT_2,
allowance,
);
// ACCOUNT_2 sends 3 tokens to ACCOUNT_3 from ACCOUNT_1.
// Balance of ACCOUNT_1 should be 9997.
// Balance of ACCOUNT_2 should be 0.
// Balance of ACCOUNT_3 should be 3.
// Allowance of ACCOUNT_2 for ACCOUNT_1 should be 7.
let send_amount = U512::from(3);
transfer_from(
&mut builder,
proxy_hash,
token_hash,
ACCOUNT_2,
ACCOUNT_1,
ACCOUNT_3,
send_amount,
);
assert_allowance(
&mut builder,
proxy_hash,
token_hash,
ACCOUNT_1,
ACCOUNT_1,
ACCOUNT_2,
allowance - send_amount,
);
assert_balance(
&mut builder,
proxy_hash,
token_hash,
ACCOUNT_1,
ACCOUNT_1,
init_balance - send_amount,
);
assert_balance(
&mut builder,
proxy_hash,
token_hash,
ACCOUNT_1,
ACCOUNT_2,
U512::zero(),
);
assert_balance(
&mut builder,
proxy_hash,
token_hash,
ACCOUNT_1,
ACCOUNT_3,
send_amount,
);
} | rust_cleaned_test_functions.jsonl/116114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1068
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2962,
17,
15,
95613,
8378,
35403,
5673,
368,
341,
262,
442,
15690,
4108,
5662,
624,
262,
1077,
5206,
7363,
284,
3393,
3297,
486,
2258,
543,
262,
7363,
7634,
16322,
13774,
2099,
17285,
42362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_chunk5() {
let index = vec![
0_usize, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60,
63, 66, 69,
];
for i in 0..69 {
assert_eq!(find_chunk(&index, i), 1 + i / 3);
}
} | rust_cleaned_test_functions.jsonl/64638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
30539,
20,
368,
341,
262,
1077,
1922,
284,
7486,
90515,
286,
220,
15,
11306,
551,
11,
220,
15,
11,
220,
18,
11,
220,
21,
11,
220,
24,
11,
220,
16,
17,
11,
220,
16,
20,
11,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_file_list() {
crate::test::init_logger();
let files = get_file_list(env::current_dir().unwrap());
assert!(files.is_ok());
assert!(!files.unwrap().is_empty());
let files = get_file_list(env::current_dir().unwrap().join("Cargo.toml")).unwrap();
assert_eq!(files[0], std::path::Path::new("Cargo.toml"));
} | rust_cleaned_test_functions.jsonl/21744 | {
"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,
3062,
2458,
2019,
368,
341,
286,
17717,
486,
1944,
486,
2327,
27413,
543,
286,
1077,
3542,
284,
633,
2458,
2019,
16978,
486,
3231,
4334,
1005,
15454,
1423,
286,
2060,
10297,
7198,
2079,
19817,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_signed_int_as_signed_real() {
test_none_with_nothing(cast_signed_int_as_signed_real);
let cs: Vec<(i64, f64)> = vec![
(i64::MIN, i64::MIN as f64),
(0, 0f64),
(i64::MAX, i64::MAX as f64),
];
for (input, expect) in cs {
let r = cast_signed_int_as_signed_real(Some(&input));
let r = r.map(|x| x.map(|x| x.into_inner()));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/1957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55617,
4042,
11898,
55617,
15266,
368,
341,
286,
1273,
31488,
6615,
6536,
1596,
1337,
559,
55617,
4042,
11898,
55617,
15266,
626,
286,
1077,
10532,
25,
11312,
28706,
72,
21,
19,
11,
282,
21,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_pop_schema_all_attributes() {
let mut conn = TestConn::default();
conn.sanitized_partition_map();
let t = r#"
[{
:db/id "e"
:db/ident :test/one
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/unique :db.unique/value
:db/index true
:db/fulltext true
}]
"#;
let partition_map0 = conn.partition_map.clone();
let schema0 = conn.schema.clone();
let report1 = assert_transact!(conn, t);
let partition_map1 = conn.partition_map.clone();
let schema1 = conn.schema.clone();
let (new_schema, new_partition_map) = move_from_main_timeline(
&conn.sqlite,
&conn.schema,
conn.partition_map.clone(),
report1.tx_id..,
1,
)
.expect("moved single tx");
update_conn(&mut conn, &new_schema, &new_partition_map);
assert_matches!(conn.datoms(), "[]");
assert_matches!(conn.transactions(), "[]");
assert_eq!(conn.partition_map, partition_map0);
assert_eq!(conn.schema, schema0);
let report2 = assert_transact!(conn, t);
let partition_map2 = conn.partition_map.clone();
let schema2 = conn.schema.clone();
assert_eq!(report1.tx_id, report2.tx_id);
assert_eq!(partition_map1, partition_map2);
assert_eq!(schema1, schema2);
assert_matches!(
conn.datoms(),
r#"
[[?e1 :db/ident :test/one]
[?e1 :db/valueType :db.type/string]
[?e1 :db/cardinality :db.cardinality/one]
[?e1 :db/unique :db.unique/value]
[?e1 :db/index true]
[?e1 :db/fulltext true]]
"#
);
assert_matches!(
conn.transactions(),
r#"
[[[?e1 :db/ident :test/one ?tx1 true]
[?e1 :db/valueType :db.type/string ?tx1 true]
[?e1 :db/cardinality :db.cardinality/one ?tx1 true]
[?e1 :db/unique :db.unique/value ?tx1 true]
[?e1 :db/index true ?tx1 true]
[?e1 :db/fulltext true ?tx1 true]
[?tx1 :db/txInstant ?ms ?tx1 true]]]
"#
);
} | rust_cleaned_test_functions.jsonl/93664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
25371,
5705,
18240,
368,
341,
286,
1077,
5206,
4534,
284,
3393,
9701,
486,
2258,
543,
286,
4534,
514,
276,
83443,
43840,
5376,
1428,
286,
1077,
259,
284,
435,
2,
698,
310,
18396,
394,
549... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shared_buffer_2_errors() {
paychains_logger::setup();
let (sender, receiver) = unbounded();
let file = SimpleReader::new(receiver);
let shared_buffer = SharedBuffer::new(file);
let mut reader = SharedBufferReader::new(&shared_buffer);
let mut reader2 = SharedBufferReader::new(&shared_buffer);
let mut data = Vec::new();
let done_signal = vec![];
let _ = sender.send((done_signal, Some(get_error())));
assert_eq!(
reader.read_to_end(&mut data).unwrap_err().kind(),
get_error().kind()
);
assert_eq!(
reader2.read_to_end(&mut data).unwrap_err().kind(),
SharedBufferReader::default_error().kind()
);
} | rust_cleaned_test_functions.jsonl/84069 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20405,
7776,
62,
17,
20196,
368,
341,
286,
2291,
58358,
27413,
486,
15188,
543,
286,
1077,
320,
11644,
11,
13964,
8,
284,
650,
65686,
543,
286,
1077,
1034,
284,
8993,
5062,
486,
931,
78126,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_unknown_root_module() {
let value = toml::toml! {
[rust]
disabled = true
};
let deserializer = ValueDeserializer::new(&value);
let result = StarshipRootConfig::deserialize(deserializer);
assert!(result.is_ok())
} | rust_cleaned_test_functions.jsonl/67387 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
57507,
12993,
10750,
368,
341,
286,
1077,
897,
284,
311,
1014,
486,
37401,
75,
0,
341,
310,
508,
35788,
921,
310,
8386,
284,
830,
198,
286,
2605,
286,
1077,
939,
41939,
284,
5162,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_genotype_field_values_with_float_values() -> io::Result<()> {
let data = [
0x15,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x3f,
0x01, 0x00, 0x80, 0x7f, // None
];
let mut reader = &data[..];
let actual = read_genotype_field_values(&mut reader, 3)?;
let expected = vec![Some(Value::Float(0.0)), Some(Value::Float(1.0)), None];
assert_eq!(actual, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/52816 | {
"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,
6443,
16322,
4156,
5013,
9146,
6615,
17586,
9146,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
821,
284,
2278,
310,
220,
15,
87,
16,
20,
11,
715,
310,
220,
15,
87,
15,
15,
11,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_module_doc_hidden() {
#[doc(hidden)]
#[pymodule]
fn my_module(_py: Python, _m: &PyModule) -> PyResult<()> {
Ok(())
}
Python::with_gil(|py| {
let m = pyo3::wrap_pymodule!(my_module)(py);
py_assert!(py, m, "m.__doc__ == ''");
})
} | rust_cleaned_test_functions.jsonl/120904 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
18869,
26739,
368,
341,
262,
11506,
5236,
57214,
5563,
262,
11506,
79,
1600,
1756,
921,
262,
5168,
847,
10750,
2490,
3288,
25,
13027,
11,
716,
76,
25,
609,
13828,
3332,
8,
1464,
5355,
207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dey() {
let mut r = Register::new();
r.set_Y(0x02);
dey(&mut r);
assert_eq!(r.get_Y(), 0x01)
} | rust_cleaned_test_functions.jsonl/14209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
88,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
435,
980,
10626,
7,
15,
87,
15,
17,
317,
262,
409,
88,
2099,
6984,
435,
317,
262,
2060,
10714,
10297,
81,
670,
10626,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_progress_resume_by_heartbeat_resp() {
setup_for_test();
let mut raft = new_test_raft(1, vec![1, 2], 5, 1, new_storage());
raft.become_candidate();
raft.become_leader();
raft.mut_prs().get_mut(2).unwrap().paused = true;
raft.step(new_message(1, 1, MessageType::MsgBeat, 0))
.expect("");
assert!(raft.prs().get(2).unwrap().paused);
raft.mut_prs().get_mut(2).unwrap().become_replicate();
raft.step(new_message(2, 1, MessageType::MsgHeartbeatResponse, 0))
.expect("");
assert!(!raft.prs().get(2).unwrap().paused);
} | rust_cleaned_test_functions.jsonl/107090 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27200,
58132,
3710,
62,
72471,
35160,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
52455,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
1125,
220,
20,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dsa_accessor() {
let dsa = Dsa::generate(2048).unwrap();
let pkey = PKey::from_dsa(dsa).unwrap();
pkey.dsa().unwrap();
assert_eq!(pkey.id(), Id::DSA);
assert!(pkey.rsa().is_err());
} | rust_cleaned_test_functions.jsonl/18716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
9081,
33901,
368,
341,
286,
1077,
294,
9081,
284,
422,
9081,
486,
19366,
7,
17,
15,
19,
23,
568,
15454,
543,
286,
1077,
281,
792,
284,
393,
1592,
486,
1499,
814,
9081,
1500,
9081,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sample_with_binxml_as_substitution_tokens_and_pi_target() {
// TODO: PI Target still cannot be parsed
test_full_sample(
sample_with_binxml_as_substitution_tokens_and_pi_target(),
335,
5,
)
} | rust_cleaned_test_functions.jsonl/64586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17491,
6615,
21816,
6455,
11898,
5228,
10446,
28838,
8378,
47771,
11123,
368,
341,
262,
442,
5343,
25,
22578,
13483,
2058,
4157,
387,
15676,
198,
262,
1273,
16372,
17491,
1006,
286,
6077,
6615,
2181... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_trim() {
assert_eq!(trim_length_left("👍foo", 3), "foo");
assert_eq!(trim_length_left("👍foo", 4), "foo");
} | rust_cleaned_test_functions.jsonl/65642 | {
"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,
70025,
368,
341,
197,
6948,
10714,
10297,
10666,
5118,
9579,
445,
144349,
7975,
497,
220,
18,
701,
330,
7975,
797,
197,
6948,
10714,
10297,
10666,
5118,
9579,
445,
144349,
7975,
497,
220,
19,
701,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_compute_bank_stats_confirmed() {
let vote_keypairs = ValidatorVoteKeypairs::new_rand();
let my_node_pubkey = vote_keypairs.node_keypair.pubkey();
let my_vote_pubkey = vote_keypairs.vote_keypair.pubkey();
let keypairs: HashMap<_, _> = vec![(my_node_pubkey, vote_keypairs)].into_iter().collect();
let (bank_forks, mut progress, mut heaviest_subtree_fork_choice) =
initialize_state(&keypairs, 10_000);
let mut latest_validator_votes_for_frozen_banks =
LatestValidatorVotesForFrozenBanks::default();
let bank0 = bank_forks.get(0).unwrap().clone();
let my_keypairs = keypairs.get(&my_node_pubkey).unwrap();
let vote_tx = vote_transaction::new_vote_transaction(
vec![0],
bank0.hash(),
bank0.last_blockhash(),
&my_keypairs.node_keypair,
&my_keypairs.vote_keypair,
&my_keypairs.vote_keypair,
None,
);
let bank_forks = RwLock::new(bank_forks);
let bank1 = Bank::new_from_parent(&bank0, &my_node_pubkey, 1);
bank1.process_transaction(&vote_tx).unwrap();
bank1.freeze();
// Test confirmations
let ancestors = bank_forks.read().unwrap().ancestors();
let mut frozen_banks: Vec<_> = bank_forks
.read()
.unwrap()
.frozen_banks()
.values()
.cloned()
.collect();
let tower = Tower::new_for_tests(0, 0.67);
let newly_computed = ReplayStage::compute_bank_stats(
&my_vote_pubkey,
&ancestors,
&mut frozen_banks,
&tower,
&mut progress,
&VoteTracker::default(),
&ClusterSlots::default(),
&bank_forks,
&mut heaviest_subtree_fork_choice,
&mut latest_validator_votes_for_frozen_banks,
);
assert_eq!(newly_computed, vec![0]);
{
let fork_progress = progress.get(&0).unwrap();
let confirmed_forks = ReplayStage::confirm_forks(
&tower,
&fork_progress.fork_stats.voted_stakes,
fork_progress.fork_stats.total_stake,
&progress,
&bank_forks,
);
assert!(confirmed_forks.is_empty());
}
bank_forks.write().unwrap().insert(bank1);
progress.insert(
1,
ForkProgress::new(bank0.last_blockhash(), None, None, 0, 0),
);
let ancestors = bank_forks.read().unwrap().ancestors();
let mut frozen_banks: Vec<_> = bank_forks
.read()
.unwrap()
.frozen_banks()
.values()
.cloned()
.collect();
let newly_computed = ReplayStage::compute_bank_stats(
&my_vote_pubkey,
&ancestors,
&mut frozen_banks,
&tower,
&mut progress,
&VoteTracker::default(),
&ClusterSlots::default(),
&bank_forks,
&mut heaviest_subtree_fork_choice,
&mut latest_validator_votes_for_frozen_banks,
);
// Bank 1 had one vote
assert_eq!(newly_computed, vec![1]);
{
let fork_progress = progress.get(&1).unwrap();
let confirmed_forks = ReplayStage::confirm_forks(
&tower,
&fork_progress.fork_stats.voted_stakes,
fork_progress.fork_stats.total_stake,
&progress,
&bank_forks,
);
// No new stats should have been computed
assert_eq!(confirmed_forks, vec![0]);
}
let ancestors = bank_forks.read().unwrap().ancestors();
let mut frozen_banks: Vec<_> = bank_forks
.read()
.unwrap()
.frozen_banks()
.values()
.cloned()
.collect();
let newly_computed = ReplayStage::compute_bank_stats(
&my_vote_pubkey,
&ancestors,
&mut frozen_banks,
&tower,
&mut progress,
&VoteTracker::default(),
&ClusterSlots::default(),
&bank_forks,
&mut heaviest_subtree_fork_choice,
&mut latest_validator_votes_for_frozen_banks,
);
// No new stats should have been computed
assert!(newly_computed.is_empty());
} | rust_cleaned_test_functions.jsonl/11055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
35733,
15381,
16059,
8434,
368,
341,
286,
1077,
6910,
3097,
77256,
284,
32566,
41412,
6608,
1082,
4720,
486,
931,
33864,
543,
286,
1077,
847,
5084,
34014,
792,
284,
6910,
3097,
77256,
12097,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.