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_between_first_is_shorter() {
let uid1 = Uid{position: big(0b1_11111000000000000000), site_id: 1, counter: 1};
let uid2 = Uid{position: big(0b1_11111000000000000000_001101010010101010101), site_id: 2, counter: 1};
let uid = Uid::between(&uid1, &uid2, DOT);
assert!(uid.position > big(0b1_11111000000000000000_000000000000000000000));
assert!(uid.position < big(0b1_11111000000000000000_000000000000000101001));
} | rust_cleaned_test_functions.jsonl/58319 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48302,
12978,
6892,
16673,
261,
368,
341,
286,
1077,
14617,
16,
284,
547,
307,
90,
3487,
25,
2409,
7,
15,
65,
16,
62,
16,
16,
16,
16,
16,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fr_add() {
let f1 = Fr::from(BigInteger([
0xc81265fb4130fe0c,
0xb308836c14e22279,
0x699e887f96bff372,
0x84ecc7e76c11ad,
]));
let f2 = Fr::from(BigInteger([
0x71875719b422efb8,
0x43658e68a93612,
0x9fa756be2011e833,
0xaa2b2cb08dac497,
]));
let f3 = Fr::from(BigInteger([
0x3999bd14f553edc4,
0xb34be8fa7d8b588c,
0x945df3db6d1dba5,
0xb279f92f046d645,
]));
assert_eq!(f1 + &f2, f3);
} | rust_cleaned_test_functions.jsonl/81832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
2891,
368,
341,
262,
1077,
282,
16,
284,
2869,
486,
1499,
91756,
8956,
286,
220,
15,
8148,
23,
16,
17,
21,
20,
10798,
19,
16,
18,
15,
1859,
15,
66,
345,
286,
220,
15,
7929,
18,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_f32x4_concatenations() {
let a = F32x4::new(4.0, 2.0, 6.0, -1.0);
let b = F32x4::new(10.0, -3.0, 15.0, 41.0);
assert_eq!(a.concat_xy_xy(b), F32x4::new(4.0, 2.0, 10.0, -3.0));
assert_eq!(a.concat_xy_zw(b), F32x4::new(4.0, 2.0, 15.0, 41.0));
assert_eq!(a.concat_zw_zw(b), F32x4::new(6.0, -1.0, 15.0, 41.0));
assert_eq!(a.concat_wz_yx(b), F32x4::new(-1.0, 6.0, -3.0, 10.0));
} | rust_cleaned_test_functions.jsonl/66186 | {
"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,
761,
18,
17,
87,
19,
57478,
268,
804,
368,
341,
262,
1077,
264,
284,
434,
18,
17,
87,
19,
486,
931,
7,
19,
13,
15,
11,
220,
17,
13,
15,
11,
220,
21,
13,
15,
11,
481,
16,
13,
15,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proof_random() {
let mut memdb = MemoryDB::new(true);
let mut trie = PatriciaTrieMut::new(&mut memdb);
let mut rng = rand::thread_rng();
let mut keys = vec![];
for _ in 0..100 {
let random_bytes: Vec<u8> = (0..rng.gen_range(2, 30))
.map(|_| rand::random::<u8>())
.collect();
trie.insert(&random_bytes, random_bytes.clone()).unwrap();
keys.push(random_bytes.clone());
}
for k in keys.clone().into_iter() {
trie.insert(&k, k.clone()).unwrap();
}
let root = trie.root().unwrap();
for k in keys.into_iter() {
let proof = trie.get_proof(&k).unwrap();
let value = trie.verify_proof(root.clone(), &k, proof).unwrap().unwrap();
assert_eq!(value, k);
}
} | rust_cleaned_test_functions.jsonl/37145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86757,
22644,
368,
341,
262,
1077,
5206,
1833,
1999,
284,
13850,
3506,
486,
931,
3715,
317,
262,
1077,
5206,
59067,
284,
53934,
51,
7231,
51440,
486,
931,
2099,
6984,
1833,
1999,
317,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_simple_style() {
let style = SimpleNamingStyle {
first_case: Case::Lower,
other_case: Case::Title,
upper_acronyms: true,
separator: "_".into(),
};
let tokens = vec![
Token {
value: "protocol".to_owned(),
is_acronym: false,
},
Token {
value: "named".to_owned(),
is_acronym: false,
},
Token {
value: "tcp".to_owned(),
is_acronym: true,
},
];
assert_eq!(style.format(&tokens), "protocol_Named_TCP");
} | rust_cleaned_test_functions.jsonl/103093 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
15117,
368,
341,
262,
1077,
1707,
284,
8993,
85410,
2323,
341,
286,
1156,
19096,
25,
11538,
486,
9053,
345,
286,
1008,
19096,
25,
11538,
486,
3851,
345,
286,
8416,
14718,
2248,
75025,
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_multifastfield_reader() {
let mut schema_builder = Schema::builder();
let facet_field = schema_builder.add_facet_field("facets");
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
let mut index_writer = index
.writer_for_tests()
.expect("Failed to create index writer.");
index_writer.add_document(doc!(
facet_field => Facet::from("/category/cat2"),
facet_field => Facet::from("/category/cat1"),
));
index_writer.add_document(doc!(facet_field => Facet::from("/category/cat2")));
index_writer.add_document(doc!(facet_field => Facet::from("/category/cat3")));
index_writer.commit().expect("Commit failed");
let searcher = index.reader().unwrap().searcher();
let segment_reader = searcher.segment_reader(0);
let mut facet_reader = segment_reader.facet_reader(facet_field).unwrap();
let mut facet = Facet::root();
{
facet_reader.facet_from_ord(1, &mut facet).unwrap();
assert_eq!(facet, Facet::from("/category"));
}
{
facet_reader.facet_from_ord(2, &mut facet).unwrap();
assert_eq!(facet, Facet::from("/category/cat1"));
}
{
facet_reader.facet_from_ord(3, &mut facet).unwrap();
assert_eq!(format!("{}", facet), "/category/cat2");
assert_eq!(facet, Facet::from("/category/cat2"));
}
{
facet_reader.facet_from_ord(4, &mut facet).unwrap();
assert_eq!(facet, Facet::from("/category/cat3"));
}
let mut vals = Vec::new();
{
facet_reader.facet_ords(0, &mut vals);
assert_eq!(&vals[..], &[2, 3]);
}
{
facet_reader.facet_ords(1, &mut vals);
assert_eq!(&vals[..], &[3]);
}
{
facet_reader.facet_ords(2, &mut vals);
assert_eq!(&vals[..], &[4]);
}
} | rust_cleaned_test_functions.jsonl/94100 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1027
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26290,
333,
559,
2566,
22306,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
44507,
5013,
284,
10802,
28532,
1364,
41589,
295,
5013,
445,
22185,
1415,
797,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_used() {
let m = &GuestMemoryMmap::from_ranges(&[(GuestAddress(0), 0x10000)]).unwrap();
let vq = VirtQueue::new(GuestAddress(0), m, 16);
let mut q = vq.create_queue();
assert_eq!(vq.used.idx.get(), 0);
//Valid queue addresses configuration
{
//index too large
match q.add_used(m, 16, 0x1000) {
Err(DescIndexOutOfBounds(16)) => (),
_ => unreachable!(),
}
//should be ok
q.add_used(m, 1, 0x1000).unwrap();
assert_eq!(vq.used.idx.get(), 1);
let x = vq.used.ring[0].get();
assert_eq!(x.id, 1);
assert_eq!(x.len, 0x1000);
}
//Invalid queue addresses configuration
{
q.used_ring = GuestAddress(0xffff_ffff);
//writing descriptor index to this ring address should fail
match q.add_used(m, 1, 0x1000) {
Err(UsedRing(GuestMemoryError::InvalidGuestAddress(GuestAddress(
0x0001_0000_000B,
)))) => {}
_ => unreachable!(),
}
q.used_ring = GuestAddress(0xfff0);
//writing len to this ring address should fail
match q.add_used(m, 1, 0x1000) {
Err(UsedRing(GuestMemoryError::InvalidGuestAddress(GuestAddress(0x1_0000)))) => {}
_ => unreachable!(),
};
}
} | rust_cleaned_test_functions.jsonl/134252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 792
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
27803,
368,
341,
286,
1077,
296,
284,
609,
37804,
10642,
44,
2186,
486,
1499,
58748,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
15,
15,
15,
7252,
568,
15454,
543,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_iter_columns_in_row() {
let r = row![
("c".to_string(), Field::Double(1.0)),
("b".to_string(), Field::Int(1))
];
let mut result = Vec::new();
for (name, record) in r.get_column_iter() {
result.push((name, record));
}
assert_eq!(
vec![
(&"c".to_string(), &Field::Double(1.0)),
(&"b".to_string(), &Field::Int(1))
],
result
);
} | rust_cleaned_test_functions.jsonl/69589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
22590,
1243,
8530,
368,
341,
286,
1077,
435,
284,
2802,
90515,
310,
3489,
66,
3263,
983,
3904,
1507,
8601,
486,
7378,
7,
16,
13,
15,
6965,
310,
3489,
65,
3263,
983,
3904,
1507,
8601,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_local_uris_with_pubkey() {
let config = Config {
peer_responder_id: ResponderId::from_str("localhost:8081").unwrap(),
client_responder_id: ResponderId::from_str("localhost:3223").unwrap(),
msg_signer_key: keypair_from_base64(
"MC4CAQAwBQYDK2VwBCIEIC50QXQll2Y9qxztvmsUgcBBIxkmk7EQjxzQTa926bKo",
)
.unwrap(),
network_path: PathBuf::from("network.toml"),
ias_api_key: "".to_string(),
ias_spid: ProviderId::from_str("22222222222222222222222222222222").unwrap(),
peer_listen_uri: PeerUri::from_str("insecure-mcp://0.0.0.0:8081/").unwrap(),
client_listen_uri: ClientUri::from_str("insecure-mc://0.0.0.0:3223/").unwrap(),
admin_listen_uri: Some(AdminUri::from_str("insecure-mca://0.0.0.0:9090/").unwrap()),
ledger_path: PathBuf::default(),
scp_debug_dump: None,
origin_block_path: None,
sealed_block_signing_key: PathBuf::default(),
client_auth_token_secret: None,
client_auth_token_max_lifetime: Duration::from_secs(60),
};
assert_eq!(
config.node_id(),
NodeID {
responder_id: ResponderId::from_str("localhost:8081").unwrap(),
public_key: keypair_from_base64(
"MC4CAQAwBQYDK2VwBCIEIC50QXQll2Y9qxztvmsUgcBBIxkmk7EQjxzQTa926bKo",
)
.unwrap()
.public_key(),
}
);
assert_eq!(
config.client_responder_id,
ResponderId::from_str("localhost:3223").unwrap(),
);
assert_eq!(
config.peer_responder_id,
ResponderId::from_str("localhost:8081").unwrap(),
);
assert_eq!(
config.client_listen_uri,
ClientUri::from_str("insecure-mc://0.0.0.0:3223/").unwrap()
);
assert_eq!(
config.peer_listen_uri,
PeerUri::from_str("insecure-mcp://0.0.0.0:8081/").unwrap()
);
assert_eq!(
config.admin_listen_uri,
Some(AdminUri::from_str("insecure-mca://0.0.0.0:9090/").unwrap())
);
} | rust_cleaned_test_functions.jsonl/3952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
64879,
285,
6615,
34014,
792,
368,
341,
286,
1077,
2193,
284,
5532,
341,
310,
14397,
4918,
20328,
842,
25,
1800,
20328,
764,
486,
1499,
2895,
445,
8301,
25,
23,
15,
23,
16,
1827,
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_primitive_array_gt_scalar_nulls() {
let a = Int32Array::from(vec![None, Some(1), Some(2)]);
let c = gt_scalar(&a, 1).unwrap();
assert_eq!(false, c.value(0));
assert_eq!(false, c.value(1));
assert_eq!(true, c.value(2));
} | rust_cleaned_test_functions.jsonl/3136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
37479,
41652,
15162,
82,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
4064,
11,
4329,
7,
16,
701,
4329,
7,
17,
41958,
286,
1077,
272,
284,
25161,
41... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handler() {
let db = CheckpointDb::new(MemoryDB::new());
let handler = db.handler();
handler.checkpoint();
let mut fork = db.fork();
fork.put("foo", vec![], vec![2]);
db.merge(fork.into_patch()).unwrap();
let snapshot = db.snapshot();
assert_eq!(snapshot.get("foo", &[]), Some(vec![2]));
handler.rollback();
let snapshot = db.snapshot();
assert_eq!(snapshot.get("foo", &[]), None);
} | rust_cleaned_test_functions.jsonl/69291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10183,
368,
341,
286,
1077,
2927,
284,
4248,
2768,
7994,
486,
931,
3189,
4731,
3506,
486,
931,
1423,
286,
1077,
7013,
284,
2927,
31171,
1428,
286,
7013,
9093,
2768,
543,
286,
1077,
5206,
22435,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_store_account_and_update_capitalization_increased() {
let old_lamports = 400;
let (genesis_config, mint_keypair) = create_genesis_config(old_lamports);
let bank = Bank::new(&genesis_config);
let pubkey = mint_keypair.pubkey();
let new_lamports = 500;
let account = AccountSharedData::new(new_lamports, 0, &system_program::id());
assert_capitalization_diff(
&bank,
|| bank.store_account_and_update_capitalization(&pubkey, &account),
|old, new| assert_eq!(old + 100, new),
);
assert_eq!(account, bank.get_account(&pubkey).unwrap());
} | rust_cleaned_test_functions.jsonl/2529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14809,
13500,
8378,
8882,
16388,
2174,
2022,
1243,
837,
1475,
368,
341,
286,
1077,
2310,
907,
309,
3394,
284,
220,
19,
15,
15,
280,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_log2_floor() {
assert_eq!(log2_floor(1), 0);
assert_eq!(log2_floor(2), 1);
assert_eq!(log2_floor(3), 1);
assert_eq!(log2_floor(4), 2);
assert_eq!(log2_floor(5), 2);
assert_eq!(log2_floor(6), 2);
assert_eq!(log2_floor(7), 2);
assert_eq!(log2_floor(8), 3);
} | rust_cleaned_test_functions.jsonl/41458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
17,
60044,
368,
341,
286,
2060,
10714,
10297,
839,
17,
60044,
7,
16,
701,
220,
15,
317,
286,
2060,
10714,
10297,
839,
17,
60044,
7,
17,
701,
220,
16,
317,
286,
2060,
10714,
10297,
839,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_attachments_matching() {
let event_state = ProcessingState::new_root(None, None);
let attachments_state = event_state.enter_static("", None, Some(ValueType::Attachments));
let txt_state = attachments_state.enter_static("file.txt", None, Some(ValueType::Binary));
let minidump_state =
attachments_state.enter_static("file.dmp", None, Some(ValueType::Minidump));
let minidump_state_inner = minidump_state.enter_static("", None, Some(ValueType::Binary));
assert_matches_pii_maybe!(attachments_state, "$attachments",);
assert_matches_pii_maybe!(txt_state, "$attachments.'file.txt'",);
assert_matches_pii_true!(txt_state, "$binary",);
// like this? Especially since we can select them with wildcard.
assert_matches_pii_true!(txt_state, "$attachments.$binary",);
assert_matches_pii_maybe!(txt_state, "$attachments.*",);
assert_matches_pii_true!(txt_state, "$attachments.**",);
assert_matches_pii_maybe!(minidump_state, "$minidump",);
assert_matches_pii_true!(minidump_state, "$attachments.$minidump",);
assert_matches_pii_true!(minidump_state_inner, "$attachments.$minidump.$binary",);
} | rust_cleaned_test_functions.jsonl/40854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 551
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98581,
70763,
368,
341,
286,
1077,
1538,
4387,
284,
28125,
1397,
486,
931,
12993,
26717,
11,
2240,
317,
286,
1077,
33679,
4387,
284,
1538,
4387,
35690,
25360,
19814,
2240,
11,
4329,
25346,
929,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_paint_str_glyphstyle_small_abc() {
let fb = &mut new_fr_buf();
let clip = ClipRect::full_screen();
clear_region(fb, clip);
let cursor = &mut Cursor::from_top_left_of(clip);
paint_str(fb, clip, cursor, GlyphStyle::Small, "abc", true, xor_char);
assert_eq!(m3hash::frame_buffer(fb, 0), 0x5DE65BFC);
} | rust_cleaned_test_functions.jsonl/73860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92284,
2895,
88703,
3528,
31966,
62,
13683,
368,
341,
286,
1077,
25469,
284,
609,
6984,
501,
41537,
10363,
543,
286,
1077,
12327,
284,
29692,
4415,
486,
8878,
17649,
543,
286,
2797,
20627,
94034,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doc_links_enum_variant() {
check(
r#"
enum E {
/// [E]
V$0 { field: i32 }
}
"#,
expect
"#]],
);
} | rust_cleaned_test_functions.jsonl/117777 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
25258,
31054,
46112,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
9018,
468,
341,
262,
1048,
508,
36,
921,
262,
647,
3,
15,
314,
2070,
25,
600,
18,
17,
456,
532,
57676,
345,
310,
1720... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fees_and_tip_split() {
new_test_ext().execute_with(|| {
let fee = Balances::issue(10);
let tip = Balances::issue(20);
assert_eq!(Balances::free_balance(AccountId::default()), 0);
DealWithFees::on_unbalanceds(vec![fee, tip].into_iter());
assert_eq!(Balances::free_balance(CollatorSelection::account_id()), 15);
assert_eq!(Balances::free_balance(Treasury::account_id()), 6);
});
} | rust_cleaned_test_functions.jsonl/24493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
5516,
8378,
48014,
17052,
368,
341,
197,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
298,
10217,
11060,
284,
19420,
3020,
486,
11159,
7,
16,
15,
317,
298,
10217,
11552,
284,
19420,
3020,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_list_almost_all_populated_directory() {
let dir = tempdir();
dir.child("one").touch().unwrap();
dir.child("two").touch().unwrap();
cmd()
.arg("--almost-all")
.arg("--ignore-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match("one\ntwo\n$").unwrap());
} | rust_cleaned_test_functions.jsonl/625 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
94418,
5705,
17061,
7757,
14846,
368,
341,
262,
1077,
5419,
284,
2730,
3741,
543,
262,
5419,
17531,
445,
603,
1827,
22020,
1005,
15454,
543,
262,
5419,
17531,
445,
19789,
1827,
22020,
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_convert_member_with_call_expression() {
let b = ast::BaseNode::default();
let pkg =
Parser::new("a.b().c").parse_single_package("path".to_string(), "foo.flux".to_string());
let got = test_convert(pkg).unwrap();
let symbols = collect_symbols(&got);
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![Statement::Expr(ExprStmt {
loc: b.location.clone(),
expression: Expression::Member(Box::new(MemberExpr {
loc: b.location.clone(),
typ: type_info(),
object: Expression::Call(Box::new(CallExpr {
loc: b.location.clone(),
typ: type_info(),
pipe: None,
callee: Expression::Member(Box::new(MemberExpr {
loc: b.location.clone(),
typ: type_info(),
object: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: symbols["a"].clone(),
}),
property: symbols["b"].clone(),
})),
arguments: Vec::new(),
})),
property: symbols["c"].clone(),
})),
})],
}],
};
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/131385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
19388,
6615,
13429,
28068,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
4035,
310,
21102,
486,
931,
445,
64,
948,
1005,
66,
1827,
6400,
19487,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_cache_index_and_filter_blocks_with_high_priority() {
let path = tempdir_with_prefix("_rust_rocksdb_set_cache_and_index_with_high_priority");
let mut opts = DBOptions::new();
let mut cf_opts = ColumnFamilyOptions::new();
opts.create_if_missing(true);
let mut block_opts = BlockBasedOptions::new();
block_opts.set_cache_index_and_filter_blocks_with_high_priority(true);
cf_opts.set_block_based_table_factory(&block_opts);
DB::open_cf(
opts,
path.path().to_str().unwrap(),
vec![("default", cf_opts)],
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/34101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
11529,
3560,
8378,
8727,
25201,
6615,
22680,
38161,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
2602,
11529,
8378,
3560,
6615,
22680,
38161,
797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_variant() {
#[derive(Deserialize, Debug, PartialEq)]
enum A {
A { x: u32, y: u16 },
}
let a = A::A { x: 54, y: 720 };
let x = crate::from_str::<A>(r#"{"A": {"x":54,"y":720 } }"#);
assert_eq!(x, Ok((a, 25)));
} | rust_cleaned_test_functions.jsonl/53510 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
46112,
368,
341,
286,
11506,
27098,
7,
64465,
11,
11091,
11,
55039,
5563,
286,
7618,
362,
341,
310,
362,
314,
856,
25,
575,
18,
17,
11,
379,
25,
575,
16,
21,
1153,
286,
456,
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_flush() {
let mut block = default_block();
let mem = block.mem.clone();
let vq = VirtQueue::new(GuestAddress(0), &mem, 16);
block.set_queue(0, vq.create_queue());
block.activate().unwrap();
initialize_virtqueue(&vq);
let request_type_addr = GuestAddress(vq.dtable[0].addr.get());
let status_addr = GuestAddress(vq.dtable[2].addr.get());
// Flush completes successfully without a data descriptor.
{
vq.dtable[0].next.set(2);
mem.write_obj::<u32>(VIRTIO_BLK_T_FLUSH, request_type_addr)
.unwrap();
invoke_handler_for_queue_event(&mut block);
assert_eq!(vq.used.idx.get(), 1);
assert_eq!(vq.used.ring[0].get().id, 0);
assert_eq!(vq.used.ring[0].get().len, 0);
assert_eq!(mem.read_obj::<u32>(status_addr).unwrap(), VIRTIO_BLK_S_OK);
}
// Flush completes successfully even with a data descriptor.
{
vq.used.idx.set(0);
block.set_queue(0, vq.create_queue());
vq.dtable[0].next.set(1);
mem.write_obj::<u32>(VIRTIO_BLK_T_FLUSH, request_type_addr)
.unwrap();
invoke_handler_for_queue_event(&mut block);
assert_eq!(vq.used.idx.get(), 1);
assert_eq!(vq.used.ring[0].get().id, 0);
assert_eq!(vq.used.ring[0].get().len, 0);
assert_eq!(mem.read_obj::<u32>(status_addr).unwrap(), VIRTIO_BLK_S_OK);
}
} | rust_cleaned_test_functions.jsonl/76940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 816
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39213,
368,
341,
286,
1077,
5206,
2504,
284,
1638,
7113,
543,
286,
1077,
1833,
284,
2504,
41493,
15997,
543,
286,
1077,
348,
80,
284,
47775,
7554,
486,
931,
6699,
3045,
4286,
7,
15,
701,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scalar_associative() {
for _ in 0..10 {
let r0 = Fp::random(&mut OsRng);
let r1 = Fp::random(&mut OsRng);
assert_eq!((r0 + r1) * g0(), r0 * g0() + r1 * g0());
}
} | rust_cleaned_test_functions.jsonl/98392 | {
"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,
41652,
58665,
1388,
368,
341,
286,
369,
716,
304,
220,
15,
496,
16,
15,
341,
310,
1077,
435,
15,
284,
434,
79,
486,
11463,
2099,
6984,
15433,
49,
968,
317,
310,
1077,
435,
16,
284,
434,
79,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_polyjuice_contract_creator_allowlist() {
let deployment_script = Script::new_builder()
.code_hash(TEST_POLYJUICE_SCRIPT_CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.args([0u8; 20].pack())
.build();
let mut dummy_state = DummyState::default();
while dummy_state.get_account_count().unwrap() < 2 {
let mut script_hash = [0u8; 32];
script_hash[0] = dummy_state.get_account_count().unwrap() as u8;
dummy_state.create_account(script_hash.into()).unwrap();
}
let deployment_id = dummy_state
.create_account(deployment_script.hash().into())
.unwrap();
dummy_state.insert_script(deployment_script.hash().into(), deployment_script);
let allowed_creator_id = {
let eth_script = Script::new_builder()
.code_hash(TEST_ETH_SCRIPT_CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.args([42u8; 52].pack())
.build();
dummy_state.insert_script(eth_script.hash().into(), eth_script.clone());
dummy_state
.create_account(eth_script.hash().into())
.unwrap()
};
let allowlist = PolyjuiceContractCreatorAllowList::new(
TEST_POLYJUICE_SCRIPT_CODE_HASH.into(),
HashSet::from_iter(vec![[42u8; 20]]),
);
// Creator from allowlist should be ok
let create_contract_tx = RawL2Transaction::new_builder()
.from_id(allowed_creator_id.pack())
.to_id(deployment_id.pack())
.args(Bytes::from(vec![3u8; 10]).pack())
.build();
assert!(allowlist
.validate_with_state(&dummy_state, &create_contract_tx)
.is_ok());
// Creator not in allowlist should be error
let non_allowed_creator_id = {
let eth_script = Script::new_builder()
.code_hash(TEST_ETH_SCRIPT_CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.args([100u8; 52].pack())
.build();
dummy_state.insert_script(eth_script.hash().into(), eth_script.clone());
dummy_state
.create_account(eth_script.hash().into())
.unwrap()
};
let create_contract_tx = RawL2Transaction::new_builder()
.from_id(non_allowed_creator_id.pack())
.to_id(deployment_id.pack())
.args(Bytes::from(vec![3u8; 10]).pack())
.build();
assert!(allowlist
.validate_with_state(&dummy_state, &create_contract_tx)
.is_err());
// Non contract creation should be ok
let non_create_contract_tx = RawL2Transaction::new_builder()
.from_id(non_allowed_creator_id.pack())
.to_id(deployment_id.pack())
.args(Bytes::from(vec![0u8; 10]).pack())
.build();
assert!(allowlist
.validate_with_state(&dummy_state, &non_create_contract_tx)
.is_ok());
// Not a polyjuice tx should be ok
let not_polyjuice_script = Script::new_builder()
.code_hash([11u8; 32].pack())
.hash_type(ScriptHashType::Type.into())
.build();
let not_polyjuice_id = dummy_state
.create_account(not_polyjuice_script.hash().into())
.unwrap();
dummy_state.insert_script(not_polyjuice_script.hash().into(), not_polyjuice_script);
let not_polyjuice_tx = RawL2Transaction::new_builder()
.from_id(non_allowed_creator_id.pack())
.to_id(not_polyjuice_id.pack())
.build();
assert!(allowlist
.validate_with_state(&dummy_state, ¬_polyjuice_tx)
.is_ok());
// Call meta contract should be failed
let reserve_script_0_tx = RawL2Transaction::new_builder()
.from_id(non_allowed_creator_id.pack())
.to_id(0u32.pack())
.build();
assert!(allowlist
.validate_with_state(&dummy_state, &reserve_script_0_tx)
.is_err());
// Reversed CKB SUDT script should be ok
let reserve_script_1_tx = RawL2Transaction::new_builder()
.from_id(non_allowed_creator_id.pack())
.to_id(1u32.pack())
.build();
assert!(allowlist
.validate_with_state(&dummy_state, &reserve_script_1_tx)
.is_ok());
} | rust_cleaned_test_functions.jsonl/112104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36133,
8613,
558,
51499,
68532,
55731,
1607,
368,
341,
286,
1077,
23172,
14660,
284,
13710,
486,
931,
28532,
741,
310,
659,
1851,
8950,
50320,
33165,
56,
41,
52,
5487,
45968,
10020,
32309,
20807,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cairo_short_string_to_felt_non_ascii() {
assert!(matches!(
cairo_short_string_to_felt("🦀"),
Err(CairoShortStringToFeltError::NonAsciiCharacter)
));
} | rust_cleaned_test_functions.jsonl/53658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
25549,
16673,
3904,
2346,
761,
3818,
21637,
50238,
368,
341,
286,
2060,
10297,
19914,
33673,
310,
53648,
16673,
3904,
2346,
761,
3818,
445,
147579,
4461,
310,
15495,
3025,
25549,
12472,
703,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_cash_addr4() -> Result<()> {
let addr =
Address::from_cash_addr("redridinghood:pqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxmg9w0gt")?;
assert_eq!(addr.addr_type(), AddressType::P2SH);
assert_eq!(
addr.cash_addr(),
"redridinghood:pqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxmg9w0gt"
);
assert_eq!(addr.hash(), &Hash160::new([0; 20]));
assert_eq!(addr.prefix_kind(), None);
assert_eq!(addr.prefix_str(), "redridinghood");
Ok(())
} | rust_cleaned_test_functions.jsonl/16404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
64363,
7387,
19,
368,
1464,
5714,
71698,
341,
286,
1077,
10789,
4035,
310,
9177,
486,
1499,
64363,
7387,
445,
1151,
49680,
5694,
44389,
27579,
27579,
27579,
27579,
27579,
27579,
27579,
27579,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_subject_match() {
assert!(subject_match("sub", "sub"));
assert!(subject_match("sub", "*"));
assert!(subject_match("sub", ">"));
assert!(!subject_match("pub", "sub"));
assert!(subject_match("sub.pub", "sub.pub"));
assert!(subject_match("sub.pub", "sub.*"));
assert!(subject_match("sub.pub", "*.pub"));
assert!(subject_match("sub.pub", "*.*"));
assert!(subject_match("sub.pub", ">"));
assert!(!subject_match("sub.pub", "sub"));
assert!(!subject_match("sub.pub", "pub"));
} | rust_cleaned_test_functions.jsonl/102467 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28834,
10708,
368,
341,
262,
2060,
10297,
11501,
10708,
445,
1966,
497,
330,
1966,
4010,
262,
2060,
10297,
11501,
10708,
445,
1966,
497,
15630,
4010,
262,
2060,
10297,
11501,
10708,
445,
1966,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_restrict_domain() {
let original = BoundedQuadratic::new(0., 2., 1., 0., 0.);
let expected_restricted = BoundedQuadratic::new(0., 1., 1., 0., 0.);
assert_eq!(original.restrict_domain(-1., 3.), original);
assert_eq!(original.restrict_domain(0., 1.), expected_restricted); // restricting works as expected
} | rust_cleaned_test_functions.jsonl/19857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
97684,
20111,
368,
341,
286,
1077,
4024,
284,
425,
13082,
2183,
88678,
486,
931,
7,
15,
2572,
220,
17,
2572,
220,
16,
2572,
220,
15,
2572,
220,
15,
58957,
286,
1077,
3601,
1288,
73072,
284,
42... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statx() {
use rustix::fs::{FsWord, StatFs, PROC_SUPER_MAGIC};
// Ensure these all have consistent types.
let t: StatFs = unsafe { std::mem::zeroed() };
let _s: FsWord = t.f_type;
let _u: FsWord = PROC_SUPER_MAGIC;
// constant comes out with the correct value.
#[cfg(all(libc, not(target_env = "musl")))]
{
assert_eq!(
i128::from(PROC_SUPER_MAGIC),
i128::from(libc::PROC_SUPER_MAGIC)
);
}
#[cfg(linux_raw)]
{
assert_eq!(
i128::from(PROC_SUPER_MAGIC),
i128::from(linux_raw_sys::general::PROC_SUPER_MAGIC)
);
}
assert_eq!(PROC_SUPER_MAGIC, 0x0000_9fa0);
} | rust_cleaned_test_functions.jsonl/124527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16271,
87,
368,
341,
262,
990,
23071,
941,
486,
3848,
22964,
48300,
10879,
11,
12166,
48300,
11,
24363,
86846,
49194,
2315,
262,
442,
29279,
1493,
678,
614,
12966,
4494,
624,
262,
1077,
259,
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_token_program_id_error() {
test_syscall_stubs();
let swap_key = Pubkey::new_unique();
let mut mint = (Pubkey::new_unique(), Account::default());
let mut destination = (Pubkey::new_unique(), Account::default());
let token_program = (spl_token::id(), Account::default());
let (authority_key, bump_seed) =
Pubkey::find_program_address(&[&swap_key.to_bytes()[..]], &SWAP_PROGRAM_ID);
let mut authority = (authority_key, Account::default());
let swap_bytes = swap_key.to_bytes();
let authority_signature_seeds = [&swap_bytes[..32], &[bump_seed]];
let signers = &[&authority_signature_seeds[..]];
let ix = mint_to(
&token_program.0,
&mint.0,
&destination.0,
&authority.0,
&[],
10,
)
.unwrap();
let mint = (&mut mint).into();
let destination = (&mut destination).into();
let authority = (&mut authority).into();
let err = invoke_signed(&ix, &[mint, destination, authority], signers).unwrap_err();
assert_eq!(err, ProgramError::InvalidAccountData);
} | rust_cleaned_test_functions.jsonl/14309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 550
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6458,
25096,
842,
4096,
368,
341,
286,
1273,
20344,
6659,
1261,
15738,
543,
286,
1077,
14291,
3097,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
5206,
28337,
284,
320,
29162,
792,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gen_weighted_bool() {
let mut r = task_rng();
assert_eq!(r.gen_weighted_bool(0u), true);
assert_eq!(r.gen_weighted_bool(1u), true);
} | rust_cleaned_test_functions.jsonl/23762 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
15876,
291,
22159,
368,
341,
286,
1077,
5206,
435,
284,
3383,
66849,
543,
286,
2060,
10714,
10297,
81,
22822,
15876,
291,
22159,
7,
15,
84,
701,
830,
317,
286,
2060,
10714,
10297,
81,
228... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_to_value_single_value_enum() {
let test = TestSingleValueExternalEnum {
a: SingleValueExternalEnum::Double(64.0),
};
let expected = Value::Record(vec![(
"a".to_owned(),
Value::Record(vec![
("type".to_owned(), Value::Enum(0, "Double".to_owned())),
(
"value".to_owned(),
Value::Union(Box::new(Value::Double(64.0))),
),
]),
)]);
assert_eq!(
to_value(test).unwrap(),
expected,
"Error serializing single value external enum"
);
let test = TestSingleValueInternalEnum {
a: SingleValueInternalEnum::Double(64.0),
};
assert_eq!(to_value(test).is_err(), true);
let test = TestSingleValueAdjacentEnum {
a: SingleValueAdjacentEnum::Double(64.0),
};
let expected = Value::Record(vec![(
"a".to_owned(),
Value::Record(vec![
("t".to_owned(), Value::String("Double".to_owned())),
("v".to_owned(), Value::Double(64.0)),
]),
)]);
assert_eq!(
to_value(test).unwrap(),
expected,
"Error serializing single value adjacent enum"
);
let test = TestSingleValueUntaggedEnum {
a: SingleValueUntaggedEnum::Double(64.0),
};
let expected = Value::Record(vec![("a".to_owned(), Value::Double(64.0))]);
assert_eq!(
to_value(test).unwrap(),
expected,
"Error serializing single value untagged enum"
);
} | rust_cleaned_test_functions.jsonl/52763 | {
"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,
2346,
3142,
19487,
3142,
31054,
368,
341,
286,
1077,
1273,
284,
3393,
10888,
1130,
25913,
10766,
341,
310,
264,
25,
11327,
1130,
25913,
10766,
486,
7378,
7,
21,
19,
13,
15,
1326,
286,
3634,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_object_expression() {
let n = ObjectExpr {
base: BaseNode::default(),
with: None,
properties: vec![Property {
base: BaseNode::default(),
key: PropertyKey::Identifier(Identifier {
base: BaseNode::default(),
name: "a".to_string(),
}),
value: Some(Expression::StringLit(StringLit {
base: BaseNode::default(),
value: "hello".to_string(),
})),
}],
};
let serialized = serde_json::to_string(&n).unwrap();
assert_eq!(
serialized,
r#"{"type":"ObjectExpression","properties":[{"type":"Property","key":{"type":"Identifier","name":"a"},"value":{"type":"StringLiteral","value":"hello"}}]}"#
);
let deserialized: ObjectExpr = serde_json::from_str(serialized.as_str()).unwrap();
assert_eq!(deserialized, n)
} | rust_cleaned_test_functions.jsonl/40435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
5314,
28068,
368,
341,
262,
1077,
308,
284,
3002,
16041,
341,
286,
2331,
25,
5351,
1955,
486,
2258,
3148,
286,
448,
25,
2240,
345,
286,
5888,
25,
7486,
20703,
3052,
341,
310,
2331,
25,
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_time_as_decimal() {
test_none_with_ctx_and_extra(cast_any_as_decimal::<Time>);
let mut ctx = EvalContext::default();
// TODO: add more test case
let cs: Vec<(Time, bool, bool, Decimal)> = vec![
(
Time::parse_datetime(&mut ctx, "2000-01-01T12:13:14", 0, false).unwrap(),
false,
false,
Decimal::from_bytes(b"20000101121314").unwrap().unwrap(),
),
(
Time::parse_datetime(&mut ctx, "2000-01-01T12:13:14.6666", 0, true).unwrap(),
false,
false,
Decimal::from_bytes(b"20000101121315").unwrap().unwrap(),
),
];
test_as_decimal_helper(
cs,
cast_closure_with_metadata!(cast_any_as_decimal::<Time>),
|x| x.to_string(),
"cast_time_as_decimal",
)
} | rust_cleaned_test_functions.jsonl/1986 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 558
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
11898,
74429,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
37248,
11898,
74429,
27638,
1462,
42013,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
2258,
1428,
286,
442,
5343... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_and_apply() {
let res = split_and_apply(
"foo",
3,
true,
&[(
SingleLineSpan {
line: 0.into(),
start_col: 0,
end_col: 3,
},
Style::new(),
)],
Side::Left,
);
assert_eq!(res, vec!["foo"])
} | rust_cleaned_test_functions.jsonl/74101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
8378,
36551,
368,
341,
286,
1077,
592,
284,
6718,
8378,
36551,
1006,
310,
330,
7975,
756,
310,
220,
18,
345,
310,
830,
345,
310,
44590,
1006,
394,
11327,
2460,
12485,
341,
503,
1555,
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_display_fmt() {
let location = SourceFileLocation::new("test_file.s", 1, 1, 1);
assert_eq!(format!("{}", Token::SingleLineComment("; Hello", location.clone())), "single-line comment");
assert_eq!(format!("{}", Token::DirectiveMarker(location.clone())), "directive marker");
assert_eq!(format!("{}", Token::Identifier("test_id", location.clone())), "identifier (test_id)");
assert_eq!(format!("{}", Token::LabelMarker(location.clone())), "label marker");
assert_eq!(format!("{}", Token::StringLiteral("Hello", location.clone())), "string literal (\"Hello\")");
assert_eq!(format!("{}", Token::NumericLiteral(12, location.clone())), "numeric literal (12 / $C)");
assert_eq!(format!("{}", Token::Comma(location.clone())), "comma");
assert_eq!(format!("{}", Token::Newline(location.clone())), "newline");
let error = scanner::Error::InvalidStringLiteral;
let expected_error_display = format!("{}.", (&error as &error::Error).description());
assert_eq!(format!("{}", Token::Error(error.clone(), location.clone())), expected_error_display);
} | rust_cleaned_test_functions.jsonl/58556 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
38128,
368,
341,
262,
1077,
3728,
284,
8748,
1703,
4707,
486,
931,
445,
1944,
2458,
514,
497,
220,
16,
11,
220,
16,
11,
220,
16,
317,
262,
2060,
10714,
10297,
2243,
79878,
9660,
486,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_self_interchange() {
let checker = MutationsChecker::new("tests/integration.rs").unwrap();
assert!(checker.has("exchange self with other", "59"));
assert!(checker.has("exchange one with other", "63"));
} | rust_cleaned_test_functions.jsonl/117857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25637,
15318,
3373,
368,
341,
262,
1077,
40915,
284,
31228,
804,
35188,
486,
931,
445,
23841,
31114,
17376,
25638,
1827,
15454,
1428,
262,
2060,
10297,
69955,
6858,
445,
39568,
656,
448,
1008,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_prove_pk_and_pk() {
let secret1 = DlogProverInput::random();
let secret2 = DlogProverInput::random();
let pk1 = secret1.public_image();
let pk2 = secret2.public_image();
let expr: Expr = SigmaAnd::new(vec![Expr::Const(pk1.into()), Expr::Const(pk2.into())])
.unwrap()
.into();
let tree: ErgoTree = expr.try_into().unwrap();
let message = vec![0u8; 100];
let prover = TestProver {
secrets: vec![secret1.into(), secret2.into()],
};
let res = prover.prove(
&tree,
&Env::empty(),
Rc::new(force_any_val::<Context>()),
message.as_slice(),
&HintsBag::empty(),
);
assert_ne!(res.unwrap().proof, ProofBytes::Empty);
} | rust_cleaned_test_functions.jsonl/3884 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2540,
586,
33321,
8378,
33321,
368,
341,
286,
1077,
6234,
16,
284,
422,
839,
1336,
423,
2505,
486,
11463,
543,
286,
1077,
6234,
17,
284,
422,
839,
1336,
423,
2505,
486,
11463,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_creation() {
let format = LoadStoreRegisterOffset::from(0x58B3);
assert_eq!(format.load, true);
assert_eq!(format.data_type, DataType::Word);
assert_eq!(format.offset_register, 2);
assert_eq!(format.rb, 6);
assert_eq!(format.rd, 3);
} | rust_cleaned_test_functions.jsonl/115681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46163,
368,
341,
286,
1077,
3561,
284,
8893,
6093,
8690,
6446,
486,
1499,
7,
15,
87,
20,
23,
33,
18,
626,
286,
2060,
10714,
10297,
2243,
5104,
11,
830,
317,
286,
2060,
10714,
10297,
2243,
2196... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buffer_is_blank_simple_cases() {
let buffer: [u8; 100] = [0; 100];
assert!(buffer_is_blank(&buffer));
assert!(buffer_is_blank(&buffer[0..10]));
assert!(buffer_is_blank(&buffer[1..2]));
assert!(buffer_is_blank(&buffer[15..20]));
assert!(buffer_is_blank(&buffer[21..37]));
} | rust_cleaned_test_functions.jsonl/96752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
6892,
56103,
30015,
41427,
368,
341,
262,
1077,
4147,
25,
508,
84,
23,
26,
220,
16,
15,
15,
60,
284,
508,
15,
26,
220,
16,
15,
15,
935,
262,
2060,
10297,
7573,
6892,
56103,
2099,
7573,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_material_set_should_parse_correct_ambient_colors() {
let tests = test_cases();
for test in tests.iter() {
let mut parser = Parser::new(&test.data);
let result = parser.parse_mtlset().unwrap();
for (result_material, expected_material)
in result.materials.iter().zip(test.expected.materials.iter()) {
assert_eq!(result_material.color_ambient, expected_material.color_ambient);
}
}
} | rust_cleaned_test_functions.jsonl/53119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
33884,
2602,
43378,
21039,
31550,
62,
59614,
33670,
368,
341,
262,
1077,
7032,
284,
1273,
41427,
1428,
262,
369,
1273,
304,
7032,
19471,
368,
341,
286,
1077,
5206,
6729,
284,
21102,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_syn_written_numeric() {
let context = Context::new(
String::from("us"),
None,
Tokens::new(HashMap::new(), HashMap::new(), HashMap::new()),
);
assert_eq!(
syn_written_numeric(
&Name::new(String::from("Twenty-third Avenue NW"), 0, None, &context),
&context
),
vec![Name::new(
String::from("23rd Avenue NW"),
-1,
Some(Source::Generated),
&context
)]
);
assert_eq!(
syn_written_numeric(
&Name::new(String::from("North twenty-Third Avenue"), 0, None, &context),
&context
),
vec![Name::new(
String::from("North 23rd Avenue"),
-1,
Some(Source::Generated),
&context
)]
);
assert_eq!(
syn_written_numeric(
&Name::new(String::from("TWENTY-THIRD Avenue"), 0, None, &context),
&context
),
vec![Name::new(
String::from("23rd Avenue"),
-1,
Some(Source::Generated),
&context
)]
);
} | rust_cleaned_test_functions.jsonl/25033 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 797
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51393,
72403,
29418,
368,
341,
286,
1077,
2266,
284,
9608,
486,
931,
1006,
310,
923,
486,
1499,
445,
355,
4461,
310,
2240,
345,
310,
58166,
486,
931,
7,
18497,
486,
931,
1507,
10528,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_param_inferred() {
let spec = "input i: Int8 output x(param): Int8 := 3 output y: Int8 := x(i)";
assert_eq!(0, num_type_errors(spec));
assert_eq!(get_type(spec), ValueTy::Int(IntTy::I8));
} | rust_cleaned_test_functions.jsonl/110680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4090,
1243,
5554,
368,
341,
286,
1077,
1398,
284,
330,
1355,
600,
25,
1333,
23,
2550,
856,
9743,
1648,
1333,
23,
1669,
220,
18,
2550,
379,
25,
1333,
23,
1669,
856,
1956,
24023,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_literal_2() {
let s = to_chars("\"test.sol\"");
let cur = &mut 0;
expect_next_token(&s, cur, Token::StringLiteral(s.as_string()));
} | rust_cleaned_test_functions.jsonl/21018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
34100,
62,
17,
368,
341,
286,
1077,
274,
284,
311,
37418,
38915,
1944,
41703,
88385,
286,
1077,
2847,
284,
609,
6984,
220,
15,
280,
286,
1720,
11257,
6458,
2099,
82,
11,
2847,
11,
9660,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_public_key_from_pem_pkcs1_generate_panic() {
let keypair = super::Rsa::generate(512).unwrap();
let pubkey_pem = keypair.public_key_to_pem().unwrap();
super::Rsa::public_key_from_pem_pkcs1(&pubkey_pem).unwrap();
} | rust_cleaned_test_functions.jsonl/28566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27074,
3097,
5673,
620,
336,
33321,
4837,
16,
48851,
620,
31270,
368,
341,
286,
1077,
1376,
12670,
284,
2256,
486,
49,
9081,
486,
19366,
7,
20,
16,
17,
568,
15454,
543,
286,
1077,
95116,
620,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remember_skipped_rewrites() {
let GenesisConfigInfo {
mut genesis_config, ..
} = create_genesis_config_with_leader(1_000_000_000, &Pubkey::new_unique(), 42);
genesis_config.rent = Rent::default();
activate_all_features(&mut genesis_config);
let bank = Bank::new_for_tests(&genesis_config);
assert!(bank.rewrites_skipped_this_slot.read().unwrap().is_empty());
bank.remember_skipped_rewrites(Vec::default());
assert!(bank.rewrites_skipped_this_slot.read().unwrap().is_empty());
// bank's map is initially empty
let mut test = vec![(Pubkey::new(&[4; 32]), Hash::new(&[5; 32]))];
bank.remember_skipped_rewrites(test.clone());
assert_eq!(
*bank.rewrites_skipped_this_slot.read().unwrap(),
test.clone().into_iter().collect()
);
// now there is already some stuff in the bank's map
test.push((Pubkey::new(&[6; 32]), Hash::new(&[7; 32])));
bank.remember_skipped_rewrites(test[1..].to_vec());
assert_eq!(
*bank.rewrites_skipped_this_slot.read().unwrap(),
test.clone().into_iter().collect()
);
// all contents are already in map
bank.remember_skipped_rewrites(test[1..].to_vec());
assert_eq!(
*bank.rewrites_skipped_this_slot.read().unwrap(),
test.clone().into_iter().collect()
);
test[0].1 = Hash::new(&[8; 32]);
test[1].1 = Hash::new(&[9; 32]);
bank.remember_skipped_rewrites(test.to_vec());
assert_eq!(
*bank.rewrites_skipped_this_slot.read().unwrap(),
test.into_iter().collect()
);
} | rust_cleaned_test_functions.jsonl/29021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 815
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
9597,
33811,
6450,
1288,
59079,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
5206,
59366,
5332,
11,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
6615,
79991,
7,
16,
62,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_valid_arguments() {
let config = Config::new(&[
"duckdns-ip-updater",
"--domain",
"mydomain",
"--token",
"mytoken",
])
.unwrap();
assert_eq!(config.get_domains(), &["mydomain"]);
assert_eq!(config.get_token(), "mytoken");
} | rust_cleaned_test_functions.jsonl/71847 | {
"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,
6615,
8337,
43433,
368,
972,
286,
1077,
2193,
284,
5532,
486,
931,
2099,
58,
319,
310,
330,
72970,
45226,
74732,
5239,
27463,
4723,
310,
14482,
12204,
4723,
310,
330,
2408,
12204,
4723,
310,
14482... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_ast() {
let ast: UserAST = ("super".into(), Or, ("cool".into(), Or, "fancy".into()).into()).into();
let ast = ast.map_ast(
&mut |ast: UserAST, _attr: Option<&str>| {
match ast {
UserAST::Leaf(ref map) if map.phrase == "cool" => UserAST::Leaf(Box::new(UserFilter { phrase: "coolcool".to_string(), levenshtein: None })),
_ => ast,
}
},
None,
);
let expected_mapped_ast: UserAST = ("super".into(), Or, ("coolcool".into(), Or, "fancy".into()).into()).into();
assert_eq!(ast, expected_mapped_ast);
let ast: UserAST = "kawaii".into();
let ast = ast.map_ast(
&mut |ast: UserAST, _attr: Option<&str>| {
match ast {
UserAST::Leaf(ref map) if map.phrase == "kawaii" => {
let leftast = UserAST::Leaf(Box::new(UserFilter { phrase: "kawaii".to_string(), levenshtein: None }));
let rightast = UserAST::Leaf(Box::new(UserFilter { phrase: "かわいい".to_string(), levenshtein: None }));
UserAST::BinaryClause(Box::new(leftast), Or, Box::new(rightast))
},
_ => ast,
}
},
None,
);
let expected_mapped_ast: UserAST = ("kawaii".into(), Or, "かわいい".into()).into();
assert_eq!(ast, expected_mapped_ast);
} | rust_cleaned_test_functions.jsonl/42781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 803
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
48019,
368,
341,
286,
1077,
11763,
25,
2657,
6349,
284,
3489,
9522,
3263,
18122,
1507,
2521,
11,
3489,
42196,
3263,
18122,
1507,
2521,
11,
330,
69,
6572,
3263,
18122,
6011,
18122,
6011,
1812... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_kind_value() {
let mut b: Bond = Bond { kind: purr::feature::BondKind::Aromatic, kind_value: 1, tid: 3, is_breaking_symmetry: false };
b.set_kind_value(&vec![2, 3], &(0, 1));
assert_eq!(b.fixed_hash_value(), 200350);
b.set_kind_value(&vec![3, 2], &(0, 1));
assert_eq!(b.fixed_hash_value(), 200350);
} | rust_cleaned_test_functions.jsonl/69020 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33162,
3142,
368,
341,
286,
1077,
5206,
293,
25,
23618,
284,
23618,
314,
3093,
25,
3999,
81,
486,
12753,
486,
89844,
10629,
486,
32,
98766,
11,
3093,
3142,
25,
220,
16,
11,
13112,
25,
220,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bind() {
Runtime::new().unwrap().block_on(async {
let config = UdpConnectionConfig::default();
let mut connection = UdpConnection::new(config);
let result = connection.bind().await;
result.unwrap();
assert_eq!(connection.is_new(), false);
assert_eq!(connection.is_bound(), true);
assert_eq!(connection.is_connected(), false);
assert_eq!(connection.is_disconnected(), false);
});
} | rust_cleaned_test_functions.jsonl/54773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27461,
368,
341,
286,
10954,
486,
931,
1005,
15454,
1005,
4574,
4470,
18285,
341,
310,
1077,
2193,
284,
547,
9796,
4526,
2648,
486,
2258,
543,
310,
1077,
5206,
3633,
284,
547,
9796,
4526,
486,
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_multi_polygon() {
let mut expected_coords = vec![];
let (polygon, mut coords) = create_polygon();
expected_coords.append(&mut coords.clone());
expected_coords.append(&mut coords);
let actual_coords = MultiPolygon::new(vec![polygon.clone(), polygon])
.coords_iter()
.collect::<Vec<_>>();
assert_eq!(expected_coords, actual_coords);
} | rust_cleaned_test_functions.jsonl/21576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
73542,
368,
341,
286,
1077,
5206,
3601,
32576,
284,
7486,
0,
15078,
286,
1077,
320,
65012,
11,
5206,
23897,
8,
284,
1855,
73542,
543,
286,
3601,
32576,
2057,
2099,
6984,
23897,
15997,
1423,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_openai_gpt_tokenizer() {
// Given
let vocab = generate_test_vocab();
let merges = generate_test_merges();
let openai_gpt_tokenizer: OpenAiGptTokenizer =
OpenAiGptTokenizer::from_existing_vocab_and_merges(vocab, merges, true);
let test_tuples = [
("The earth", vec!["the</w>", "ea", "rth</w>"]),
("", vec![]),
(" ", vec![]),
(" \n ", vec![]),
];
let source_texts: Vec<&str> = test_tuples.iter().map(|v| v.0).collect();
let expected_results: Vec<Vec<&str>> = test_tuples.iter().map(|v| v.1.clone()).collect();
for (source_text, expected_result) in test_tuples.iter() {
assert_eq!(
openai_gpt_tokenizer.tokenize(*source_text),
*expected_result
);
}
assert_eq!(
MultiThreadedTokenizer::tokenize_list(&openai_gpt_tokenizer, &source_texts),
expected_results
);
} | rust_cleaned_test_functions.jsonl/114294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 548
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
2143,
1889,
417,
6458,
3135,
368,
341,
286,
442,
286,
16246,
198,
286,
1077,
23820,
284,
6923,
4452,
52823,
543,
286,
1077,
80953,
284,
6923,
4452,
717,
2375,
288,
543,
286,
1077,
1787,
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... | 2 |
#[test]
fn test_lookup() {
let authority = create_example();
let mut catalog = Catalog::new();
catalog.upsert(authority.origin().clone(), Box::new(authority));
let mut io_loop = Runtime::new().unwrap();
let (stream, sender) = TestClientStream::new(Arc::new(Mutex::new(catalog)));
let dns_conn = DnsMultiplexer::new(stream, Box::new(sender), NoopMessageFinalizer::new());
let client = DnsExchange::connect::<_, _, TokioTime>(dns_conn);
let (client, bg) = io_loop.block_on(client).expect("client failed to connect");
trust_dns_proto::spawn_bg(&io_loop, bg);
let lookup = LookupFuture::lookup(
vec![Name::from_str("www.example.com.").unwrap()],
RecordType::A,
Default::default(),
CachingClient::new(0, client, false),
);
let lookup = io_loop.block_on(lookup).unwrap();
assert_eq!(
*lookup.iter().next().unwrap(),
RData::A(Ipv4Addr::new(93, 184, 216, 34))
);
} | rust_cleaned_test_functions.jsonl/21983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
368,
341,
262,
1077,
11198,
284,
1855,
39304,
543,
262,
1077,
5206,
16403,
284,
31221,
486,
931,
543,
262,
16403,
17652,
6047,
48269,
487,
20248,
1005,
19982,
1507,
8261,
486,
931,
48269,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_escape() {
assert_eq!(escape("hello"), Cow::Borrowed("hello"));
assert_eq!(
escape("a \n b \r c \t d \" e \\ f"),
Cow::Owned::<str>("a \\n b \\r c \\t d \\\" e \\\\ f".to_string())
);
} | rust_cleaned_test_functions.jsonl/5687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21832,
368,
341,
286,
2060,
10714,
10297,
12998,
445,
14990,
3975,
21851,
486,
33,
7768,
291,
445,
14990,
4010,
286,
2060,
10714,
33673,
310,
12449,
445,
64,
1124,
77,
293,
1124,
81,
272,
1124,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_14() {
assert_eq!(
Solution::longest_common_prefix(vec![
"".to_string(),
"racecar".to_string(),
"car".to_string()
]),
""
);
assert_eq!(
Solution::longest_common_prefix(vec![
"flower".to_string(),
"flow".to_string(),
"flight".to_string()
]),
"fl"
);
assert_eq!(Solution::longest_common_prefix(vec![]), "");
} | rust_cleaned_test_functions.jsonl/33222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
19,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
4825,
477,
21107,
13974,
25592,
90515,
394,
44907,
983,
3904,
3148,
394,
330,
41183,
6918,
3263,
983,
3904,
3148,
394,
330,
6918,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assert_panics_with_too_few_requests() {
let mock = mock("GET", "/hello").expect(3).create();
request("GET /hello", "");
request("GET /hello", "");
mock.assert();
} | rust_cleaned_test_functions.jsonl/82440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16553,
71099,
1211,
6615,
2346,
78,
761,
365,
37216,
368,
341,
262,
1077,
7860,
284,
7860,
445,
3806,
497,
3521,
14990,
1827,
17119,
7,
18,
568,
3182,
1428,
262,
1681,
445,
3806,
608,
14990,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_try_panic_any_message_unit_struct() {
struct Juju;
match thread::spawn(move || panic_any(Juju)).join() {
Err(ref e) if e.is::<Juju>() => {}
Err(_) | Ok(()) => panic!(),
}
} | rust_cleaned_test_functions.jsonl/44050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
620,
31270,
37248,
6462,
14832,
15126,
368,
341,
262,
2036,
21671,
8613,
401,
262,
2432,
4516,
486,
46087,
34081,
1369,
21975,
37248,
16368,
72301,
4579,
5987,
368,
341,
286,
15495,
13321,
38... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_send_px_and_backoff_in_prune() {
let config: GossipsubConfig = GossipsubConfig::default();
//build mesh with enough peers for px
let (mut gs, peers, topics) = inject_nodes1()
.peer_no(config.prune_peers() + 1)
.topics(vec!["test".into()])
.to_subscribe(true)
.create_network();
//send prune to peer
gs.send_graft_prune(
HashMap::new(),
vec![(peers[0].clone(), vec![topics[0].clone()])]
.into_iter()
.collect(),
HashSet::new(),
);
//check prune message
assert_eq!(
count_control_msgs(&gs, |peer_id, m| peer_id == &peers[0]
&& match m {
GossipsubControlAction::Prune {
topic_hash,
peers,
backoff,
} =>
topic_hash == &topics[0] &&
peers.len() == config.prune_peers() &&
//all peers are different
peers.iter().collect::<HashSet<_>>().len() ==
config.prune_peers() &&
backoff.unwrap() == config.prune_backoff().as_secs(),
_ => false,
}),
1
);
} | rust_cleaned_test_functions.jsonl/66898 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 805
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
67162,
8378,
3895,
1847,
1243,
5294,
2886,
368,
341,
286,
1077,
2193,
25,
479,
41473,
1966,
2648,
284,
479,
41473,
1966,
2648,
486,
2258,
1428,
286,
442,
5834,
11294,
448,
3322,
25029,
369,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_invalid_req_body() {
let engine = TestEngineBuilder::new().build().unwrap();
let read_pool = build_read_pool_for_test(engine.clone());
let cop = Endpoint::<RocksEngine>::new(&Config::default(), read_pool);
let mut req = coppb::Request::default();
req.set_tp(REQ_TYPE_DAG);
req.set_data(vec![1, 2, 3]);
let resp = cop
.parse_and_handle_unary_request(req, None)
.wait()
.unwrap();
assert!(!resp.get_other_error().is_empty());
} | rust_cleaned_test_functions.jsonl/40858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
17644,
14114,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
1349,
15709,
284,
1936,
6443,
15709,
5478,
4452,
48974,
15997,
1423,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_email() {
let email = Email::new("test-from@email.org", "test-to@email.org", "Body text");
assert_eq!(email.to_string(), "{\"from\":\"test-from@email.org\",\"to\":\"test-to@email.org\",\"textbody\":\"Body text\"}");
} | rust_cleaned_test_functions.jsonl/67589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
9172,
368,
341,
262,
1077,
2551,
284,
8299,
486,
931,
445,
1944,
38051,
71776,
2659,
497,
330,
1944,
4686,
71776,
2659,
497,
330,
5444,
1467,
797,
262,
2060,
10714,
10297,
2332,
2389,
3904,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_file_never_excludes() {
let file = IgnoreFile::from_strings(&[], &base_dir()).expect("test ignore file invalid");
assert!(!file.is_excluded(&base_dir().join("target")));
} | rust_cleaned_test_functions.jsonl/9291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
2458,
13925,
423,
2702,
7396,
368,
341,
286,
1077,
1034,
284,
38971,
1703,
486,
1499,
33500,
2099,
12995,
609,
3152,
4334,
6011,
17119,
445,
1944,
10034,
1034,
8318,
3071,
286,
2060,
0,
347... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_qualify_path_1() {
check_assist(
add_missing_impl_members,
"
mod foo {
pub struct Bar;
trait Foo { fn foo(&self, bar: Bar); }
}
struct S;
impl foo::Foo for S { <|> }",
"
mod foo {
pub struct Bar;
trait Foo { fn foo(&self, bar: Bar); }
}
struct S;
impl foo::Foo for S {
<|>fn foo(&self, bar: foo::Bar) { unimplemented!() }
}",
);
} | rust_cleaned_test_functions.jsonl/106816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64391,
1437,
2638,
62,
16,
368,
341,
286,
1779,
12083,
380,
1006,
310,
912,
40447,
21007,
30397,
345,
310,
6228,
2593,
15229,
341,
262,
6675,
2036,
4716,
280,
262,
17567,
33428,
314,
5168,
15229,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_join_key() {
assert_eq!("some".to_owned().join_key(&"path".to_string()), "some/path");
assert_eq!("some".to_owned().join_key(&"".to_string()), "some/");
assert_eq!("".to_owned().join_key(&"path".to_string()), "path");
assert_eq!("".to_owned().join_key(&"".to_string()), "");
} | rust_cleaned_test_functions.jsonl/124529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
3097,
368,
341,
286,
2060,
10714,
17223,
14689,
3263,
983,
51973,
1005,
5987,
3097,
2099,
1,
2343,
3263,
983,
3904,
11858,
330,
14689,
50976,
797,
286,
2060,
10714,
17223,
14689,
3263,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize() {
::init().unwrap();
let value_ron = "Default(Some(42))";
let value_de: GenericFormattedValue = ron::de::from_str(value_ron).unwrap();
assert_eq!(value_de, GenericFormattedValue::Default(Default::from(42)));
let value_json = "{\"Default\":42}";
let value_de: GenericFormattedValue = serde_json::from_str(value_json).unwrap();
assert_eq!(value_de, GenericFormattedValue::Default(Default::from(42)));
let value_ron = "Other(Percent, 42)";
let value_de: GenericFormattedValue = ron::de::from_str(value_ron).unwrap();
assert_eq!(value_de, GenericFormattedValue::Other(Format::Percent, 42));
let value_json = "{\"Other\":[\"Percent\",42]}";
let value_de: GenericFormattedValue = serde_json::from_str(value_json).unwrap();
assert_eq!(value_de, GenericFormattedValue::Other(Format::Percent, 42));
} | rust_cleaned_test_functions.jsonl/21902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
368,
341,
286,
3504,
2327,
1005,
15454,
1428,
286,
1077,
897,
1710,
263,
284,
330,
3675,
65405,
7,
19,
17,
593,
876,
286,
1077,
897,
2259,
25,
21281,
43500,
1130,
284,
435,
263,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_api_public_get_following_address_existent() {
let mut testkit = AnchoringTestKit::default();
let requests = testkit.requests();
let api = testkit.api();
let (cfg_proposal, following_cfg) =
gen_following_cfg_exclude_validator(&mut testkit, Height(10));
let following_addr = following_cfg.redeem_script().1;
anchor_first_block(&mut testkit);
anchor_first_block_lect_normal(&mut testkit);
requests.expect(vec![
request! {
method: "importaddress",
params: [&following_addr, "multisig", false, false]
},
confirmations_request(&testkit.latest_anchored_tx(), 0),
]);
testkit.commit_configuration_change(cfg_proposal);
testkit.create_block();
assert_eq!(api.following_address(), Some(following_addr));
} | rust_cleaned_test_functions.jsonl/80049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11697,
27074,
3062,
43490,
287,
6744,
2702,
18128,
368,
341,
262,
1077,
5206,
1273,
8226,
284,
71484,
5503,
2271,
7695,
486,
2258,
543,
262,
1077,
7388,
284,
1273,
8226,
67671,
543,
262,
1077,
633... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transaction_input() {
let raw_input = sample_transaction_input();
let input_bytes = hex::decode(&raw_input).unwrap();
let mut parser = BytesParser::new(&input_bytes);
let input: TransactionInput = parser.parse_with(2).unwrap();
let previous_hash = H256Le::from_hex_le("7b1eabe0209b1fe794124575ef807057c77ada2138ae4fa8d6c4de0398a14f3f");
assert!(matches!(input.source, TransactionInputSource::FromOutput(hash, 0) if hash == previous_hash));
assert_eq!(input.sequence, u32::max_value());
assert_eq!(input.script.len(), 73);
} | rust_cleaned_test_functions.jsonl/132189 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
28884,
5898,
368,
341,
286,
1077,
7112,
5898,
284,
6077,
28884,
5898,
543,
286,
1077,
1946,
12524,
284,
12371,
486,
18196,
2099,
1041,
5898,
568,
15454,
543,
286,
1077,
5206,
6729,
284,
300... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_integer_no_fraction() {
match Variant::VInteger(42).divide(Variant::VInteger(2)).unwrap() {
Variant::VInteger(result) => assert_eq!(result, 21),
_ => panic!("assertion failed"),
}
} | rust_cleaned_test_functions.jsonl/84625 | {
"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,
31725,
6536,
59023,
368,
341,
394,
2432,
39292,
486,
53,
3486,
7,
19,
17,
568,
59394,
12410,
15341,
486,
53,
3486,
7,
17,
4579,
15454,
368,
341,
503,
39292,
486,
53,
3486,
4456,
8,
589,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_scalar_repr_mul2() {
let mut a = ScalarRepr::from(23712937547);
a.mul2();
assert_eq!(a, ScalarRepr::new([0xb0acd6c96, 0x0, 0x0, 0x0]));
for _ in 0..60 {
a.mul2();
}
assert_eq!(
a,
ScalarRepr::new([0x6000000000000000, 0xb0acd6c9, 0x0, 0x0])
);
for _ in 0..128 {
a.mul2();
}
assert_eq!(
a,
ScalarRepr::new([0x0, 0x0, 0x6000000000000000, 0xb0acd6c9])
);
for _ in 0..60 {
a.mul2();
}
assert_eq!(a, ScalarRepr::new([0x0, 0x0, 0x0, 0x9600000000000000]));
for _ in 0..7 {
a.mul2();
}
assert!(a.is_zero());
} | rust_cleaned_test_functions.jsonl/56391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 496
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
68535,
24944,
17,
368,
341,
286,
1077,
5206,
264,
284,
35176,
693,
649,
486,
1499,
7,
17,
18,
22,
16,
17,
24,
18,
22,
20,
19,
22,
317,
286,
264,
53141,
17,
543,
286,
2060,
10714,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_pod_constant_harmless_inside_type() {
// Check that the presence of this constant doesn't break anything.
let hdr = indoc! {"
#include <cstdint>
struct Bob {
uint32_t a;
};
struct Anna {
uint32_t a;
const Bob BOB = Bob { 10 };
};
"};
let rs = quote! {};
run_test("", hdr, rs, &[], &["Anna"]);
} | rust_cleaned_test_functions.jsonl/9815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85337,
34967,
1523,
2178,
1717,
72860,
1819,
368,
341,
262,
442,
4248,
429,
279,
9362,
315,
419,
6783,
3171,
944,
1438,
4113,
624,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_prefix() {
macro_rules! t(
($path:expr, $exp:expr) => (
{
let path = $path;
let exp = $exp;
let res = parse_prefix(path);
assert!(res == exp,
"parse_prefix(\"{}\"): expected {:?}, found {:?}", path, exp, res);
}
)
)
t!("\\\\SERVER\\share\\foo", Some(UNCPrefix(6,5)));
t!("\\\\", None);
t!("\\\\SERVER", None);
t!("\\\\SERVER\\", None);
t!("\\\\SERVER\\\\", None);
t!("\\\\SERVER\\\\foo", None);
t!("\\\\SERVER\\share", Some(UNCPrefix(6,5)));
t!("\\\\SERVER/share/foo", Some(UNCPrefix(6,5)));
t!("\\\\SERVER\\share/foo", Some(UNCPrefix(6,5)));
t!("//SERVER/share/foo", None);
t!("\\\\\\a\\b\\c", None);
t!("\\\\?\\a\\b\\c", Some(VerbatimPrefix(1)));
t!("\\\\?\\a/b/c", Some(VerbatimPrefix(5)));
t!("//?/a/b/c", None);
t!("\\\\.\\a\\b", Some(DeviceNSPrefix(1)));
t!("\\\\.\\a/b", Some(DeviceNSPrefix(3)));
t!("//./a/b", None);
t!("\\\\?\\UNC\\server\\share\\foo", Some(VerbatimUNCPrefix(6,5)));
t!("\\\\?\\UNC\\\\share\\foo", Some(VerbatimUNCPrefix(0,5)));
t!("\\\\?\\UNC\\", Some(VerbatimUNCPrefix(0,0)));
t!("\\\\?\\UNC\\server/share/foo", Some(VerbatimUNCPrefix(16,0)));
t!("\\\\?\\UNC\\server", Some(VerbatimUNCPrefix(6,0)));
t!("\\\\?\\UNC\\server\\", Some(VerbatimUNCPrefix(6,0)));
t!("\\\\?\\UNC/server/share", Some(VerbatimPrefix(16)));
t!("\\\\?\\UNC", Some(VerbatimPrefix(3)));
t!("\\\\?\\C:\\a\\b.txt", Some(VerbatimDiskPrefix));
t!("\\\\?\\z:\\", Some(VerbatimDiskPrefix));
t!("\\\\?\\C:", Some(VerbatimPrefix(2)));
t!("\\\\?\\C:a.txt", Some(VerbatimPrefix(7)));
t!("\\\\?\\C:a\\b.txt", Some(VerbatimPrefix(3)));
t!("\\\\?\\C:/a", Some(VerbatimPrefix(4)));
t!("C:\\foo", Some(DiskPrefix));
t!("z:/foo", Some(DiskPrefix));
t!("d:", Some(DiskPrefix));
t!("ab:", None);
t!("ü:\\foo", None);
t!("3:\\foo", None);
t!(" :\\foo", None);
t!("::\\foo", None);
t!("\\\\?\\C:", Some(VerbatimPrefix(2)));
t!("\\\\?\\z:\\", Some(VerbatimDiskPrefix));
t!("\\\\?\\ab:\\", Some(VerbatimPrefix(3)));
t!("\\\\?\\C:\\a", Some(VerbatimDiskPrefix));
t!("\\\\?\\C:/a", Some(VerbatimPrefix(4)));
t!("\\\\?\\C:\\a/b", Some(VerbatimDiskPrefix));
} | rust_cleaned_test_functions.jsonl/54446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1466
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
13974,
368,
341,
286,
18072,
21407,
0,
259,
1006,
310,
1711,
2343,
96011,
11,
400,
4580,
96011,
8,
589,
2399,
394,
341,
503,
1077,
1815,
284,
400,
2343,
280,
503,
1077,
1343,
284,
400,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_literal() {
let x = hex2binary("D2FE28").unwrap();
let (_, p) = parse_packet(&x).unwrap();
assert_eq!(
p,
Packet::LiteralPacket {
version: 6,
type_id: 4,
num: 2021,
}
)
} | rust_cleaned_test_functions.jsonl/6775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34100,
368,
341,
286,
1077,
856,
284,
12371,
17,
25891,
445,
35,
17,
11419,
17,
23,
1827,
15454,
543,
286,
1077,
39464,
281,
8,
284,
4715,
21078,
2099,
87,
568,
15454,
543,
286,
2060,
10714,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reset() {
let (rx, rp) = crate::test::create_client();
rp.digital.reset();
assert_eq!("DIG:RST\r\n", rx.recv().unwrap());
} | rust_cleaned_test_functions.jsonl/15580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18983,
368,
341,
286,
1077,
320,
12651,
11,
33109,
8,
284,
17717,
486,
1944,
486,
3182,
8179,
1428,
286,
33109,
87446,
13857,
543,
286,
2060,
10714,
17223,
86929,
25,
49,
784,
12016,
1699,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_recursive_function1() {
test(
"var x = 0; (function x() { return x ? x() : 3; })();",
"var x; (function x1() { return x1 ? x1() : 3; })();",
);
} | rust_cleaned_test_functions.jsonl/27664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66242,
9174,
16,
368,
341,
262,
1273,
1006,
286,
330,
947,
856,
284,
220,
15,
26,
320,
1688,
856,
368,
314,
470,
856,
937,
856,
368,
549,
220,
18,
26,
6413,
2129,
756,
286,
330,
947,
856,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_request_processor_allow_validator_exit_config() {
let exit = Arc::new(AtomicBool::new(false));
let validator_exit = create_validator_exit(&exit);
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::default()));
let config = JsonRpcConfig {
enable_validator_exit: true,
..JsonRpcConfig::default()
};
let bank_forks = new_bank_forks().0;
let cluster_info = Arc::new(ClusterInfo::default());
let tpu_address = cluster_info.my_contact_info().tpu;
let (request_processor, receiver) = JsonRpcRequestProcessor::new(
config,
None,
bank_forks.clone(),
block_commitment_cache,
blockstore,
validator_exit,
RpcHealth::stub(),
cluster_info,
Hash::default(),
Arc::new(tokio::runtime::Runtime::new().unwrap()),
None,
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks),
);
SendTransactionService::new(tpu_address, &bank_forks, None, receiver, 1000, 1);
assert_eq!(request_processor.validator_exit(), true);
assert_eq!(exit.load(Ordering::Relaxed), true);
} | rust_cleaned_test_functions.jsonl/57672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
7893,
50127,
55731,
64959,
16880,
5332,
368,
341,
286,
1077,
4869,
284,
19689,
486,
931,
7,
65857,
11233,
486,
931,
3576,
1106,
286,
1077,
22935,
16880,
284,
1855,
64959,
16880,
2099,
13652,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tipo() {
assert_eq!(tipo("intaa"), Ok(("aa", Tipo::INT)));
assert_eq!(tipo("floataa"), Ok(("aa", Tipo::FLOAT)));
assert_eq!(
tipo("laksl"),
Err(NomErr::Error(VerboseError {
errors: vec![
("laksl", VerboseErrorKind::Nom(ErrorKind::Tag)),
("laksl", VerboseErrorKind::Nom(ErrorKind::Alt)),
("laksl", VerboseErrorKind::Context("tipo")),
]
}))
);
} | rust_cleaned_test_functions.jsonl/117164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43659,
368,
341,
286,
2060,
10714,
10297,
21194,
445,
396,
5305,
3975,
7622,
30873,
5305,
497,
45020,
486,
3221,
4945,
286,
2060,
10714,
10297,
21194,
445,
89806,
459,
64,
3975,
7622,
30873,
5305,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_limit_array_with_limit_too_large() {
let a = Int32Array::from(vec![5, 6, 7, 8, 9]);
let a_ref: ArrayRef = Arc::new(a);
let b = limit(&a_ref, 6);
let c = b.as_ref().as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(5, c.len());
assert_eq!(5, c.value(0));
assert_eq!(6, c.value(1));
assert_eq!(7, c.value(2));
assert_eq!(8, c.value(3));
assert_eq!(9, c.value(4));
} | rust_cleaned_test_functions.jsonl/56710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14763,
3858,
6615,
14763,
2346,
78,
45228,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
2558,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inner_macro_rules() {
parse_macro(
r#"
macro_rules! foo {
($a:ident, $b:ident, $c:tt) => {
macro_rules! bar {
($bi:ident) => {
fn $bi() -> u8 {$c}
}
}
bar!($a);
fn $b() -> u8 {$c}
}
}
"#,
).
assert_expand_items(
r#"foo!(x,y, 1);"#,
r#"macro_rules ! bar {($ bi : ident) => {fn $ bi () -> u8 {1}}} bar ! (x) ; fn y () -> u8 {1}"#,
);
} | rust_cleaned_test_functions.jsonl/28758 | {
"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,
34345,
58810,
21407,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
32606,
21407,
0,
15229,
341,
262,
1711,
64,
25,
1713,
11,
400,
65,
25,
1713,
11,
400,
66,
25,
5566,
8,
589,
1476,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_first_seq_num_and_limit() {
assert!(get_first_seq_num_and_limit(Order::Ascending, 0, 0).is_err());
// ascending
assert_eq!(
get_first_seq_num_and_limit(Order::Ascending, 0, 4).unwrap(),
(0, 4)
);
assert_eq!(
get_first_seq_num_and_limit(Order::Ascending, 0, 1).unwrap(),
(0, 1)
);
// descending
assert_eq!(
get_first_seq_num_and_limit(Order::Descending, 2, 1).unwrap(),
(2, 1)
);
assert_eq!(
get_first_seq_num_and_limit(Order::Descending, 2, 2).unwrap(),
(1, 2)
);
assert_eq!(
get_first_seq_num_and_limit(Order::Descending, 2, 3).unwrap(),
(0, 3)
);
assert_eq!(
get_first_seq_num_and_limit(Order::Descending, 2, 4).unwrap(),
(0, 3)
);
} | rust_cleaned_test_functions.jsonl/23588 | {
"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,
3062,
12978,
14486,
4273,
8378,
14763,
368,
341,
262,
2060,
10297,
455,
12978,
14486,
4273,
8378,
14763,
39692,
486,
82952,
11,
220,
15,
11,
220,
15,
568,
285,
9266,
5231,
262,
442,
35388,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_empty() {
run_with_server(|test_env| {
let ref bins = test_env.server.storage.lock().unwrap().get_bin_summaries();
assert!(bins.is_empty());
})
} | rust_cleaned_test_functions.jsonl/56476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
15124,
368,
341,
262,
1598,
6615,
12015,
22428,
1944,
15879,
91,
341,
286,
1077,
2053,
28518,
284,
1273,
15879,
12638,
22403,
21003,
1005,
15454,
1005,
455,
21816,
10160,
89333,
543,
286,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_datetime_format() {
let dt = NaiveDate::from_ymd(2010, 9, 8).and_hms_milli(7, 6, 54, 321);
assert_eq!(dt.format("%c").to_string(), "Wed Sep 8 07:06:54 2010");
assert_eq!(dt.format("%s").to_string(), "1283929614");
assert_eq!(dt.format("%t%n%%%n%t").to_string(), "\t\n%\n\t");
// a horror of leap second: coming near to you.
let dt = NaiveDate::from_ymd(2012, 6, 30).and_hms_milli(23, 59, 59, 1_000);
assert_eq!(dt.format("%c").to_string(), "Sat Jun 30 23:59:60 2012");
assert_eq!(dt.format("%s").to_string(), "1341100799");
} | rust_cleaned_test_functions.jsonl/76827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28943,
8955,
368,
341,
286,
1077,
7594,
284,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
7,
17,
15,
16,
15,
11,
220,
24,
11,
220,
23,
568,
437,
1523,
1011,
717,
57168,
7,
22,
11,
220,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merged() {
let base = StrVectorClock::new();
let c1 = base.incr_clone("A");
let c2 = base.incr_clone("B");
let m = c1.merge_with(&c2);
assert_eq!(m.temporal_relation(&c1), TemporalRelation::EffectOf);
assert_eq!(c1.temporal_relation(&m), TemporalRelation::Caused);
assert_eq!(m.temporal_relation(&c2), TemporalRelation::EffectOf);
assert_eq!(c2.temporal_relation(&m), TemporalRelation::Caused);
} | rust_cleaned_test_functions.jsonl/60188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90702,
368,
341,
286,
1077,
2331,
284,
4509,
3781,
26104,
486,
931,
543,
286,
1077,
272,
16,
284,
2331,
1858,
5082,
54742,
445,
32,
797,
286,
1077,
272,
17,
284,
2331,
1858,
5082,
54742,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eu4_bin() {
let data = utils::request("ragusa2.bin.eu4");
let (save, encoding) = Eu4Extractor::extract_save(Cursor::new(&data[..])).unwrap();
assert_eq!(encoding, Encoding::BinZip);
assert_eq!(save.meta.player, "CRO".parse().unwrap());
let (save2, _) = Eu4Extractor::extract_meta_optimistic(Cursor::new(&data[..])).unwrap();
assert!(save2.game.is_none());
let query = Query::from_save(save);
let province_owners = query.province_owners();
let nation_events = query.nation_events(&province_owners);
let histories = query.player_histories(&nation_events);
assert_eq!(
query.starting_country(&histories),
Some("RAG".parse().unwrap())
);
assert_eq!(query.players(), vec![]);
let expected_histories = vec![PlayerHistory {
history: NationEvents {
initial: "RAG".parse().unwrap(),
latest: "CRO".parse().unwrap(),
stored: "CRO".parse().unwrap(),
events: vec![NationEvent {
date: Eu4Date::from_ymd(1769, 1, 2),
kind: NationEventKind::TagSwitch("CRO".parse().unwrap()),
}],
},
is_human: true,
player_names: Vec::new(),
}];
assert_eq!(expected_histories, histories);
} | rust_cleaned_test_functions.jsonl/97707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 571
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
84,
19,
21816,
368,
341,
262,
1077,
821,
284,
12439,
486,
2035,
445,
4101,
30753,
17,
29394,
35003,
19,
797,
262,
1077,
320,
6628,
11,
11170,
8,
284,
21963,
19,
56118,
486,
23493,
15376,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_item_refcnt() {
Python::with_gil(|py| {
let cnt;
{
let _pool = unsafe { crate::GILPool::new() };
let none = py.None();
cnt = none.get_refcnt(py);
let _dict = [(10, none)].into_py_dict(py);
}
{
assert_eq!(cnt, py.None().get_refcnt(py));
}
});
} | rust_cleaned_test_functions.jsonl/7722 | {
"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,
2602,
5634,
7793,
15853,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
13195,
280,
310,
341,
394,
1077,
716,
10285,
284,
19860,
314,
17717,
486,
38,
1715,
10551,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_pre_order_key_case_2() {
let text = "AAAAA-BBBBB-CCCCC-DDDD -> Pre-order game key";
let parsed_input = parse_message(text);
assert_eq!(parsed_input.value, "AAAAA-BBBBB-CCCCC-DDDD");
assert_eq!(
parsed_input.description,
Some(format!("Pre-order game key"))
);
assert_eq!(parsed_input.object_info, None);
assert_eq!(parsed_input.object_type, ObjectType::KeyPreorder);
} | rust_cleaned_test_functions.jsonl/97574 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
10442,
7869,
3097,
19096,
62,
17,
368,
341,
286,
1077,
1467,
284,
330,
25699,
32,
7671,
73442,
12,
47932,
34,
40175,
4103,
1464,
4968,
23810,
1809,
1376,
876,
286,
1077,
15676,
5898,
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_one_minus_one_plus_line() {
let config = make_config_from_args(&[
"--line-numbers",
"--line-numbers-left-format",
"{nm:^4}⋮",
"--line-numbers-right-format",
"{np:^4}│",
"--line-numbers-left-style",
"0 1",
"--line-numbers-minus-style",
"0 2",
"--line-numbers-right-style",
"0 3",
"--line-numbers-plus-style",
"0 4",
]);
let output = run_delta(ONE_MINUS_ONE_PLUS_LINE_DIFF, &config);
let output = strip_ansi_codes(&output);
let mut lines = output.lines().skip(7);
assert_eq!(lines.next().unwrap(), " 1 ⋮ 1 │a = 1");
assert_eq!(lines.next().unwrap(), " 2 ⋮ │b = 2");
assert_eq!(lines.next().unwrap(), " ⋮ 2 │bb = 2");
} | rust_cleaned_test_functions.jsonl/54580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 499
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
38457,
11667,
28043,
6528,
368,
341,
286,
1077,
2193,
284,
1281,
5332,
5673,
8384,
2099,
9640,
310,
14482,
1056,
31194,
1902,
756,
310,
14482,
1056,
31194,
1902,
7950,
38380,
756,
310,
13868,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chain_after_error() {
test_chain(
// Error in after
(vec![Fine, Fine, Fine], Fine, vec![Prob, Prob, Prob]),
(vec![Fine, Fine, Fine], Fine, vec![Fine, Prob, Prob]),
);
} | rust_cleaned_test_functions.jsonl/39006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30583,
19844,
4096,
368,
341,
262,
1273,
30583,
1006,
286,
442,
4600,
304,
1283,
198,
286,
320,
4083,
20703,
63716,
11,
30153,
11,
30153,
1125,
30153,
11,
7486,
20703,
36980,
11,
25627,
11,
25627,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_collect_up_to_works_for_one() {
let test_items = vec![1];
let results = collect_up_to(10, test_items.iter());
assert_eq!(results.items, vec![&1]);
assert!(!results.is_empty());
} | rust_cleaned_test_functions.jsonl/22252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
8237,
2346,
11498,
82,
5478,
11667,
368,
341,
262,
1077,
1273,
12134,
284,
7486,
20703,
16,
935,
262,
1077,
3059,
284,
6530,
8237,
2346,
7,
16,
15,
11,
1273,
12134,
19471,
1423,
262,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_structure_type_native() {
let resp = post_http_request(r#"{
"id": 42,
"jsonrpc": "2.0",
"method": "get_spent_transaction",
"params": [{
"outpoint": {
"tx_hash": "0xa4aee7ae950d7fb74271816566827832d50ebf3fc04234927314fd332c4cd112",
"index": "0x2"
},
"structure_type": "Native"
}]
}"#);
let r = &resp["result"];
assert_eq!(r["value"]["tx_status"]["status"], "committed");
assert_eq!(r["value"]["tx_status"]["block_hash"], "0x54af022e0fdebed3690ee6d6e2368f3c976c6ad6cfcdbfa307869fd57c2d5129");
let tx = &r["value"]["transaction"];
assert_eq!(tx["hash"], "0x3020e90284f2d4f51b79471245939d043e958c60ba5dc95b212f8cbd8b875bd1");
let inputs = &tx["inputs"].as_array().unwrap();
assert_eq!(inputs.len(), 2);
assert_eq!(inputs[1]["previous_output"]["tx_hash"], "0xa4aee7ae950d7fb74271816566827832d50ebf3fc04234927314fd332c4cd112");
assert_eq!(inputs[1]["previous_output"]["index"], "0x2");
let outputs = &tx["outputs"].as_array().unwrap();
assert_eq!(outputs.len(), 3);
let output = outputs.iter().find(|outputs| outputs["capacity"] == "0x7efc5e6418").unwrap();
assert_eq!(output["lock"]["args"], "0xa3b8598e1d53e6c5e89e8acb6b4c34d3adb13f2b");
assert_eq!(output["type"], Value::Null);
let outputs_data = &tx["outputs_data"].as_array().unwrap();
assert_eq!(outputs_data.len(), 3);
} | rust_cleaned_test_functions.jsonl/127547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 758
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38283,
1819,
44494,
368,
341,
1066,
262,
1077,
9039,
284,
1736,
25888,
7893,
2601,
55543,
515,
286,
330,
307,
788,
220,
19,
17,
345,
286,
330,
2236,
29414,
788,
330,
17,
13,
15,
756,
286,
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_bitv_set_union() {
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(9));
assert!(a.insert(11));
assert!(a.insert(160));
assert!(a.insert(19));
assert!(a.insert(24));
assert!(b.insert(1));
assert!(b.insert(5));
assert!(b.insert(9));
assert!(b.insert(13));
assert!(b.insert(19));
let mut i = 0;
let expected = [1, 3, 5, 9, 11, 13, 19, 24, 160];
a.union(&b, |x| {
assert_eq!(*x, expected[i]);
i += 1;
true
});
assert_eq!(i, expected.len());
} | rust_cleaned_test_functions.jsonl/12159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 426
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
85,
2602,
51621,
368,
341,
286,
1077,
5206,
264,
284,
6495,
85,
1649,
486,
931,
543,
286,
1077,
5206,
293,
284,
6495,
85,
1649,
486,
931,
543,
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_v5() {
let config = idna::Config::default()
.verify_dns_length(true)
.use_std3_ascii_rules(true);
// IdnaTest:784 蔏。𑰺
assert!(is_combining_mark('\u{11C3A}'));
assert!(config.to_ascii("\u{11C3A}").is_err());
assert!(config.to_ascii("\u{850f}.\u{11C3A}").is_err());
assert!(config.to_ascii("\u{850f}\u{ff61}\u{11C3A}").is_err());
} | rust_cleaned_test_functions.jsonl/13895 | {
"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,
2273,
20,
368,
341,
262,
1077,
2193,
284,
877,
3376,
486,
2648,
486,
2258,
741,
286,
659,
12446,
71125,
5118,
3715,
340,
286,
659,
810,
15656,
18,
50238,
21407,
3715,
626,
262,
442,
5223,
3376,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_render_to_utf8_string() {
use crate::render::Renderer;
let colors = &[Color::Dark, Color::Light, Color::Light, Color::Dark];
let image: String = Renderer::<Dense1x2>::new(colors, 2, 1).build();
assert_eq!(&image, " ▄ \n ▀ ");
let image2 = Renderer::<Dense1x2>::new(colors, 2, 1).module_dimensions(2, 2).build();
assert_eq!(&image2, " \n ██ \n ██ \n ");
} | rust_cleaned_test_functions.jsonl/105287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22781,
2346,
39453,
23,
3904,
368,
341,
262,
990,
17717,
486,
7322,
486,
11541,
280,
262,
1077,
7987,
284,
44590,
1636,
486,
25830,
11,
3478,
486,
13911,
11,
3478,
486,
13911,
11,
3478,
486,
258... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_invalid_page() -> Result<(), Error> {
let mut pager = open_test_pager()?;
let mut page = [0; PAGE_SIZE];
let result = pager.read_page(1, &mut page);
assert_eq!(Error::IncorrectPageNumber, result.unwrap_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/127402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
31433,
6129,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
52588,
284,
1787,
4452,
620,
1409,
94136,
286,
1077,
5206,
2150,
284,
508,
15,
26,
25040,
4098,
935,
286,
1077,
1102,
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... | 2 |
#[test]
fn test_restore_from_old_state() -> Result<()> {
better_panic::install();
let old_settings_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("tests")
.join("data")
.join("v0.15.0_settings.yml");
let settings: Settings = Settings::read_with_defaults(true, &Some(old_settings_path))
.context("Failed to read old config with defaults:")?;
assert!(settings.daemon.groups.get(PUEUE_DEFAULT_GROUP).is_some());
assert_eq!(
settings.daemon.groups.get(PUEUE_DEFAULT_GROUP).unwrap(),
&1,
"The default parallel setting for the 'default' group should be 1."
);
Ok(())
} | rust_cleaned_test_functions.jsonl/116784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62677,
5673,
21108,
4387,
368,
1464,
5714,
71698,
341,
262,
2664,
620,
31270,
486,
12248,
543,
262,
1077,
2310,
10853,
2638,
284,
7933,
15064,
486,
1499,
16978,
17223,
34,
7581,
46,
25143,
91120,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_binary_files_differ() {
let options = get_command_line_options();
let output = strip_ansi_codes(&run_delta(BINARY_FILES_DIFFER, &options)).to_string();
assert!(output.contains("Binary files /dev/null and b/foo differ\n"));
} | rust_cleaned_test_functions.jsonl/61850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
10931,
814,
14320,
368,
341,
286,
1077,
2606,
284,
633,
10811,
6528,
8743,
543,
286,
1077,
2550,
284,
13316,
62,
52067,
38482,
2099,
6108,
26710,
5349,
32593,
48010,
53984,
640,
11,
609,
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_neuron_remove_permissions_of_different_principal() {
local_test_on_sns_subnet(|runtime| async move {
let user = Sender::from_keypair(&TEST_USER1_KEYPAIR);
let additional_user = Sender::from_keypair(&TEST_USER2_KEYPAIR);
let account_identifier = AccountIdentifier::from(user.get_principal_id());
let alloc = Tokens::from_tokens(1000).unwrap();
let system_params = NervousSystemParameters {
// Just grant ManagePrincipals to the claimer
neuron_claimer_permissions: Some(NeuronPermissionList {
permissions: vec![NeuronPermissionType::ManagePrincipals as i32],
}),
// Be able to grant all permissions
neuron_grantable_permissions: Some(NeuronPermissionList {
permissions: NeuronPermissionType::all(),
}),
..NervousSystemParameters::with_default_values()
};
let sns_init_payload = SnsInitPayloadsBuilder::new()
.with_ledger_account(account_identifier, alloc)
.with_nervous_system_parameters(system_params)
.build();
let sns_canisters = SnsCanisters::set_up(&runtime, sns_init_payload).await;
let neuron_id = sns_canisters.stake_and_claim_neuron(&user, None).await;
let neuron = sns_canisters.get_neuron(&neuron_id).await;
let subaccount = neuron.subaccount().expect("Error creating the subaccount");
// Add all the permissions for the additional user to eventually be removed
sns_canisters
.add_neuron_permissions(
&user,
&subaccount,
Some(additional_user.get_principal_id()),
NeuronPermissionType::all(),
)
.await;
// Assert that a new PrincipalId was added
let neuron = sns_canisters.get_neuron(&neuron_id).await;
assert_eq!(neuron.permissions.len(), 2);
// Remove a single permission of a different PrincipalId
sns_canisters
.remove_neuron_permissions(
&user,
&subaccount,
&additional_user.get_principal_id(),
vec![NeuronPermissionType::MergeMaturity as i32],
)
.await;
// Assert that no new PrincipalId was removed and the correct permissions have been removed
let neuron = sns_canisters.get_neuron(&neuron_id).await;
assert_eq!(neuron.permissions.len(), 2);
let neuron_permission =
get_neuron_permission_from_neuron(&neuron, &additional_user.get_principal_id());
let permissions = neuron_permission.permission_type;
assert_eq!(permissions.len(), NeuronPermissionType::all().len() - 1);
let permission_set: HashSet<i32> = HashSet::from_iter(permissions);
assert!(!permission_set.contains(&(NeuronPermissionType::MergeMaturity as i32)));
// Remove the rest of the permissions a user has
sns_canisters
.remove_neuron_permissions(
&user,
&subaccount,
&additional_user.get_principal_id(),
Vec::from_iter(permission_set),
)
.await;
// Assert the additional_user was removed from the neuron
let neuron = sns_canisters.get_neuron(&neuron_id).await;
assert_eq!(neuron.permissions.len(), 1);
assert_ne!(
neuron.permissions[0].principal.unwrap(),
additional_user.get_principal_id()
);
Ok(())
});
} | rust_cleaned_test_functions.jsonl/107263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1659
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
36090,
18193,
44767,
3575,
82741,
82402,
368,
341,
262,
2205,
4452,
4470,
643,
4412,
95681,
22428,
22255,
91,
3312,
3271,
341,
286,
1077,
1196,
284,
54610,
486,
1499,
3097,
12670,
2099,
10033... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_metadata_item() {
let dataset = Dataset::open(fixture!("tinymarble.png")).unwrap();
let key = "None";
let domain = "None";
let meta = dataset.metadata_item(key, domain);
assert_eq!(meta, None);
let key = "INTERLEAVE";
let domain = "IMAGE_STRUCTURE";
let meta = dataset.metadata_item(key, domain);
assert_eq!(meta, Some(String::from("PIXEL")));
} | rust_cleaned_test_functions.jsonl/83436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
22220,
5634,
368,
341,
262,
1077,
10337,
284,
39183,
486,
2508,
94886,
17223,
55971,
1600,
277,
891,
3508,
15197,
15454,
543,
262,
1077,
1376,
284,
330,
4064,
876,
262,
1077,
7947,
284,
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_psbt() {
let psbt_bytes = Vec::from_hex(
"70736274ff0100750200000001268171371edff285e937adeea4b37b78000c0566\
cbb3ad64641713ca42171bf60000000000feffffff02d3dff505000000001976a91\
4d0c59903c5bac2868760e90fd521a4665aa7652088ac00e1f5050000000017a914\
3545e6e33b832c47050f24d3eeb93c9c03948bc787b32e1300000100fda50101000\
00000010289a3c71eab4d20e0371bbba4cc698fa295c9463afa2e397f8533ccb62f\
9567e50100000017160014be18d152a9b012039daf3da7de4f53349eecb985fffff\
fff86f8aa43a71dff1448893a530a7237ef6b4608bbb2dd2d0171e63aec6a4890b4\
0100000017160014fe3e9ef1a745e974d902c4355943abcb34bd5353ffffffff020\
0c2eb0b000000001976a91485cff1097fd9e008bb34af709c62197b38978a4888ac\
72fef84e2c00000017a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587024\
7304402202712be22e0270f394f568311dc7ca9a68970b8025fdd3b240229f07f8a\
5f3a240220018b38d7dcd314e734c9276bd6fb40f673325bc4baa144c800d2f2f02\
db2765c012103d2e15674941bad4a996372cb87e1856d3652606d98562fe39c5e9e\
7e413f210502483045022100d12b852d85dcd961d2f5f4ab660654df6eedcc794c0\
c33ce5cc309ffb5fce58d022067338a8e0e1725c197fb1a88af59f51e44e4255b20\
167c8684031c05d1f2592a01210223b72beef0965d10be0778efecd61fcac6f79a4\
ea169393380734464f84f2ab300000000000000"
).unwrap();
let psbt: PartiallySignedTransaction =
consensus::deserialize(&psbt_bytes).unwrap();
test_encoding_roundtrip(&psbt, &psbt_bytes).unwrap();
} | rust_cleaned_test_functions.jsonl/43975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 948
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26047,
12755,
368,
341,
286,
1077,
4726,
12755,
12524,
284,
11312,
486,
1499,
32655,
1006,
310,
330,
22,
15,
22,
18,
21,
17,
22,
19,
542,
15,
16,
15,
15,
22,
20,
15,
17,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_decode_with_compression() -> BaseRtResult<()> {
let mut bs = BytesMut::with_capacity(4);
let mut _bs = BytesMut::with_capacity(4);
let mut blk: Block = Default::default();
let col: Column = Column {
name: b"col_1".to_vec(),
data: BaseChunk {
btype: BqlType::String,
size: 3,
data: b"\x06abcDEF\x03!@#\x01*".to_vec(),
null_map: None,
offset_map: None,
lc_dict_data: None,
},
};
blk.ncols = 1;
blk.nrows = col.data.size;
blk.columns.push(col);
blk.encode_to(&mut bs, Some(&mut _bs))?;
println!("encoded block: {:?}", &bs[..]);
bs.split_to(2); //skip msg protocol header
//decompress
let nread = process_data_blk(&mut &bs[..], &mut _bs, true)?;
assert!(nread > 0);
println!(
"process_data_blk: nread - {}, _bs.len: {}",
nread,
_bs.len()
);
let mut blk2 = Block::default();
blk2.decode_from(&mut &_bs[..])?;
println!("block2: {:?}", blk2);
assert_eq!(blk.columns.len(), blk2.columns.len());
assert_eq!(blk.columns[0].data.btype, blk2.columns[0].data.btype);
assert_eq!(blk.columns[0].data.data, blk2.columns[0].data.data);
assert_eq!(blk2.columns[0].data.null_map.is_none(), true);
assert_eq!(blk2.columns[0].data.btype, BqlType::String);
assert_eq!(blk2.columns[0].data.offset_map.is_some(), true);
println!("{:?}", blk2.columns[0].data.offset_map.as_ref().unwrap());
Ok(())
} | rust_cleaned_test_functions.jsonl/23918 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 976
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
15227,
6615,
2965,
4011,
368,
1464,
5351,
49,
83,
2077,
71698,
341,
286,
1077,
5206,
17065,
284,
30024,
51440,
486,
4197,
35603,
7,
19,
317,
286,
1077,
5206,
716,
1279,
284,
30024,
51440,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_signature_fromstr() {
let signature = Keypair::new().sign_message(&[0u8]);
let mut signature_base58_str = bs58::encode(signature).into_string();
assert_eq!(signature_base58_str.parse::<Signature>(), Ok(signature));
signature_base58_str.push_str(&bs58::encode(signature.0).into_string());
assert_eq!(
signature_base58_str.parse::<Signature>(),
Err(ParseSignatureError::WrongSize)
);
signature_base58_str.truncate(signature_base58_str.len() / 2);
assert_eq!(signature_base58_str.parse::<Signature>(), Ok(signature));
signature_base58_str.truncate(signature_base58_str.len() / 2);
assert_eq!(
signature_base58_str.parse::<Signature>(),
Err(ParseSignatureError::WrongSize)
);
let mut signature_base58_str = bs58::encode(signature.0).into_string();
assert_eq!(signature_base58_str.parse::<Signature>(), Ok(signature));
// throw some non-base58 stuff in there
signature_base58_str.replace_range(..1, "I");
assert_eq!(
signature_base58_str.parse::<Signature>(),
Err(ParseSignatureError::Invalid)
);
} | rust_cleaned_test_functions.jsonl/8412 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 569
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39859,
5673,
495,
368,
341,
286,
1077,
11957,
284,
6569,
1082,
1310,
486,
931,
1005,
7752,
6462,
2099,
58,
15,
84,
23,
10149,
286,
1077,
5206,
11957,
7651,
20,
23,
2895,
284,
17065,
20,
23,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_all_with_whitespace() {
let source = "> + < - . , [ ]";
let instructions = Parser::parse_instructions(&Parser::parse_string(source));
assert_eq!(
instructions,
vec![
Instruction::FWD(1),
Instruction::INC(1),
Instruction::BAK(1),
Instruction::DEC(1),
Instruction::OUT,
Instruction::IN,
Instruction::IF,
Instruction::EIF,
]
);
} | rust_cleaned_test_functions.jsonl/56689 | {
"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,
21039,
5705,
6615,
86175,
368,
341,
262,
1077,
2530,
284,
28957,
488,
366,
481,
659,
1154,
508,
2279,
876,
262,
1077,
11221,
284,
21102,
486,
6400,
82427,
2099,
6570,
486,
6400,
3904,
12437,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.