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_get_public_ip_addr() {
let (_server_port, (server_udp_socket, server_tcp_listener)) =
bind_common_in_range((3200, 3250)).unwrap();
let (client_port, (client_udp_socket, client_tcp_listener)) =
bind_common_in_range((3200, 3250)).unwrap();
let _runtime = ip_echo_server(server_tcp_listener);
let ip_echo_server_addr = server_udp_socket.local_addr().unwrap();
get_public_ip_addr(&ip_echo_server_addr).unwrap();
verify_reachable_ports(
&ip_echo_server_addr,
vec![(client_port, client_tcp_listener)],
&[&client_udp_socket],
);
} | rust_cleaned_test_functions.jsonl/3531 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
27074,
10385,
7387,
368,
341,
286,
1077,
5453,
4030,
8716,
11,
320,
4030,
69432,
19555,
11,
3538,
45562,
46493,
593,
4035,
310,
10719,
21107,
1243,
9698,
1188,
18,
17,
15,
15,
11,
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_func_as_param() {
fn test_func(id : &UserId) -> &UserId {
id
}
fn test_func_str(id : &str) -> &str {
id
}
let uid = "my-uid".into();
let uid_fres : &UserId = test_func(&uid);
let str_fres = test_func_str(uid.as_ref());
assert_eq!(uid_fres.value(), "my-uid");
assert_eq!(str_fres, "my-uid");
} | rust_cleaned_test_functions.jsonl/70878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9596,
11898,
4090,
368,
341,
286,
5168,
1273,
9596,
3724,
549,
609,
13504,
8,
1464,
609,
13504,
341,
310,
877,
198,
286,
555,
286,
5168,
1273,
9596,
2895,
3724,
549,
609,
495,
8,
1464,
609,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_log_merge_policy_small_segments() {
// segments under min_layer_size are merged together
let test_input = vec![
create_random_segment_meta(1),
create_random_segment_meta(1),
create_random_segment_meta(1),
create_random_segment_meta(2),
create_random_segment_meta(2),
create_random_segment_meta(2),
];
let result_list = test_merge_policy().compute_merge_candidates(&test_input);
assert_eq!(result_list.len(), 1);
} | rust_cleaned_test_functions.jsonl/57298 | {
"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,
5224,
20888,
22773,
31966,
55735,
368,
341,
286,
442,
20632,
1212,
1308,
12680,
2368,
525,
26001,
3786,
198,
286,
1077,
1273,
5898,
284,
7486,
90515,
310,
1855,
22644,
28061,
13381,
7,
16,
1326,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sane_chunk() {
let x = 1;
let y = 1 << (uint::BITS - 1);
let mut trie = TrieSet::new();
assert!(trie.insert(x));
assert!(trie.insert(y));
assert_eq!(trie.len(), 2);
let expected = [x, y];
for (i, x) in trie.iter().enumerate() {
assert_eq!(expected[i], x);
}
} | rust_cleaned_test_functions.jsonl/5911 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
2145,
30539,
368,
341,
286,
1077,
856,
284,
220,
16,
280,
286,
1077,
379,
284,
220,
16,
1115,
320,
2496,
486,
69542,
481,
220,
16,
626,
286,
1077,
5206,
59067,
284,
62783,
1649,
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... | 2 |
#[test]
fn test_compaction_readahead_size() {
let path = tempdir_with_prefix("_rust_rocksdb_compaction_readahead_size");
let mut opts = DBOptions::new();
opts.create_if_missing(true);
opts.set_compaction_readahead_size(2048);
let db = DB::open(opts, path.path().to_str().unwrap()).unwrap();
drop(db);
} | rust_cleaned_test_functions.jsonl/34083 | {
"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,
18177,
1311,
6443,
42787,
2368,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
18177,
1311,
6443,
42787,
2368,
797,
262,
1077,
5206,
12185,
284,
5952,
379... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lower_triangular_matrix_determinant() {
let matrix: Matrix2x2<f64> = Matrix2x2::new(
2_f64, 0_f64,
5_f64, 3_f64
);
assert_eq!(matrix.determinant(), 2_f64 * 3_f64);
} | rust_cleaned_test_functions.jsonl/128969 | {
"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,
30425,
42120,
4234,
10193,
814,
16483,
517,
368,
341,
286,
1077,
6172,
25,
11631,
17,
87,
17,
63895,
21,
19,
29,
284,
11631,
17,
87,
17,
486,
931,
1006,
310,
220,
17,
761,
21,
19,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reserve() {
let mut v = Vec::new();
assert_eq!(v.capacity(), 0);
v.reserve(2);
assert!(v.capacity() >= 2);
for i in 0..16 {
v.push(i);
}
assert!(v.capacity() >= 16);
v.reserve(16);
assert!(v.capacity() >= 32);
v.push(16);
v.reserve(16);
assert!(v.capacity() >= 33)
} | rust_cleaned_test_functions.jsonl/24390 | {
"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,
89591,
368,
341,
262,
1077,
5206,
348,
284,
11312,
486,
931,
543,
262,
2060,
10714,
10297,
85,
59168,
1507,
220,
15,
626,
262,
348,
48520,
7,
17,
317,
262,
2060,
10297,
85,
59168,
368,
2604,
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_parse_valid_cloudformation_get_template() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"cloudformation-get-template.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
CloudFormationClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = GetTemplateInput::default();
let result = client.get_template(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/28696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
37356,
1627,
3062,
8693,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
12361,
1627,
22491,
3340... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_mut_getters() {
#[derive(EnumAsMutGetters, Debug)]
enum MyEnum {
Foo(i64),
Bar(bool),
Baz(String),
Tup(i32, String, Vec<bool>),
}
let mut foo = MyEnum::Foo(42);
let mut bar = MyEnum::Bar(false);
let mut baz = MyEnum::Baz("hurry boy, it's waiting there for you".to_string());
let mut tup = MyEnum::Tup(42, String::from("Hello, Tuple, my old friend!"), vec![true, false, true]);
assert_eq!(*foo.as_mut_foo(), 42);
assert_eq!(*bar.as_mut_bar(), false);
assert_eq!(baz.as_mut_baz(), "hurry boy, it's waiting there for you");
assert_eq!(tup.as_mut_tup(), (&mut 42, &mut String::from("Hello, Tuple, my old friend!"), &mut vec![true, false, true]));
*foo.as_mut_foo() = 84;
assert_eq!(*foo.as_mut_foo(), 84);
} | rust_cleaned_test_functions.jsonl/7414 | {
"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,
11898,
29523,
3062,
5045,
368,
341,
262,
11506,
27098,
62382,
2121,
51440,
1949,
5045,
11,
11091,
5563,
262,
7618,
3017,
10766,
341,
286,
33428,
1956,
21,
19,
1326,
286,
4716,
9764,
1326,
286,
917... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_serialization_theme_serialize() {
let mut theme: Theme = Theme::default();
theme.auth_address = Color::Rgb(240, 240, 240);
let tmpfile: tempfile::NamedTempFile = tempfile::NamedTempFile::new().unwrap();
let (reader, writer) = create_file_ioers(tmpfile.path());
assert!(serialize(&theme, Box::new(writer)).is_ok());
// Try to deserialize
let deserialized_theme: Theme = deserialize(Box::new(reader)).ok().unwrap();
assert_eq!(theme, deserialized_theme);
} | rust_cleaned_test_functions.jsonl/16008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
25602,
2022,
19864,
88686,
368,
341,
286,
1077,
5206,
6912,
25,
16442,
284,
16442,
486,
2258,
543,
286,
6912,
8967,
6744,
284,
3478,
486,
80951,
7,
17,
19,
15,
11,
220,
17,
19,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_block_integ() -> BaseRtResult<()> {
let bms_path = "/tmp/xxx";
let qtn = "test_db.test_tab";
prepare_bms(bms_path)?;
//gen blk
let col_len = 1024 * 1024usize;
let cdata1: Vec<u32> = (0..col_len as u32).collect();
let cdata2: Vec<u32> = cdata1.iter().map(|e| 2 * (*e) + 1354291200).collect();
let mut blk = BaseDataBlock::default();
let col1: BaseColumn = BaseColumn {
name: b"col1".to_vec(),
data: BaseChunk {
btype: BqlType::UInt(32),
size: col_len,
data: shape_vec_u8(cdata1),
null_map: None,
offset_map: None,
lc_dict_data: None,
},
};
let col2: BaseColumn = BaseColumn {
name: b"col2".to_vec(),
data: BaseChunk {
btype: BqlType::UInt(32),
size: col_len,
data: shape_vec_u8(cdata2),
null_map: None,
offset_map: None,
lc_dict_data: None,
},
};
blk.columns.push(col1);
blk.columns.push(col2);
blk.ncols = blk.columns.len();
blk.nrows = col_len;
let qtn = "test_db.test_tab";
let tid = BMS
.meta_store
.tid_by_qname(qtn)
.ok_or(BaseRtError::TableNotExist)?;
write_block(&mut blk, qtn, tid)?;
let mut siz_count = 0;
let mut num_files_count = 0;
for entry in WalkDir::new([bms_path, "data"].join("/")).into_iter()
{
let e = entry.unwrap();
let fp = e.path();
if fp.is_file() {
num_files_count += 1;
let f = File::open(fp).unwrap();
let flen = f.metadata().unwrap().len();
assert!(flen > 0);
siz_count += flen;
}
}
assert_eq!(num_files_count, 50);
assert_eq!(siz_count, 8 * 1024 * 1024);
Ok(())
} | rust_cleaned_test_functions.jsonl/22475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
7113,
4042,
791,
368,
1464,
5351,
49,
83,
2077,
71698,
341,
286,
1077,
293,
1011,
2638,
284,
3521,
5173,
14,
24048,
876,
286,
1077,
2804,
1517,
284,
330,
1944,
8685,
5958,
17344,
876,
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... | 6 |
#[test]
fn test_debug() {
let request = Client::new().get("/").header("x-test", "111");
let repr = format!("{:?}", request);
assert!(repr.contains("ClientRequest"));
assert!(repr.contains("x-test"));
} | rust_cleaned_test_functions.jsonl/38607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
286,
1077,
1681,
284,
8423,
486,
931,
1005,
455,
4283,
1827,
2708,
445,
87,
16839,
497,
330,
16,
16,
16,
797,
286,
1077,
30636,
284,
3561,
88928,
25,
52652,
1681,
317,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_num_bytes() {
let field = BooleanBitfield::from_bytes(INPUT);
assert_eq!(field.num_bytes(), 2);
let field = BooleanBitfield::from_elem(2, true);
assert_eq!(field.num_bytes(), 1);
let field = BooleanBitfield::from_elem(13, true);
assert_eq!(field.num_bytes(), 2);
} | rust_cleaned_test_functions.jsonl/30477 | {
"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,
4273,
12524,
368,
341,
286,
1077,
2070,
284,
6992,
8344,
2566,
486,
1499,
12524,
57911,
317,
286,
2060,
10714,
10297,
2566,
10522,
12524,
1507,
220,
17,
626,
286,
1077,
2070,
284,
6992,
8344,
2566... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_initializer_build_resolver() {
let temp = TempDir::new().unwrap();
let engine = TestEngineBuilder::new()
.path(temp.path())
.cfs(DATA_CFS)
.build()
.unwrap();
let mut expected_locks = BTreeMap::<TimeStamp, HashSet<Arc<[u8]>>>::new();
let mut total_bytes = 0;
// Pessimistic locks should not be tracked
for i in 0..10 {
let k = &[b'k', i];
total_bytes += k.len();
let ts = TimeStamp::new(i as _);
must_acquire_pessimistic_lock(&engine, k, k, ts, ts);
}
for i in 10..100 {
let (k, v) = (&[b'k', i], &[b'v', i]);
total_bytes += k.len();
total_bytes += v.len();
let ts = TimeStamp::new(i as _);
must_prewrite_put(&engine, k, v, k, ts);
expected_locks
.entry(ts)
.or_default()
.insert(k.to_vec().into());
}
let region = Region::default();
let snap = engine.snapshot(Default::default()).unwrap();
// Buffer must be large enough to unblock async incremental scan.
let buffer = 1000;
let (mut worker, pool, mut initializer, rx, mut drain) =
mock_initializer(total_bytes, buffer);
let check_result = || loop {
let task = rx.recv().unwrap();
match task {
Task::ResolverReady { resolver, .. } => {
assert_eq!(resolver.locks(), &expected_locks);
return;
}
t => panic!("unepxected task {} received", t),
}
};
// To not block test by barrier.
pool.spawn(async move {
let mut d = drain.drain();
while d.next().await.is_some() {}
});
block_on(initializer.async_incremental_scan(snap.clone(), region.clone())).unwrap();
check_result();
initializer.max_scan_batch_bytes = total_bytes;
block_on(initializer.async_incremental_scan(snap.clone(), region.clone())).unwrap();
check_result();
initializer.max_scan_batch_bytes = total_bytes / 3;
let start_1_3 = Instant::now();
block_on(initializer.async_incremental_scan(snap.clone(), region.clone())).unwrap();
check_result();
// 2s to allow certain inaccuracy.
assert!(
start_1_3.elapsed() >= Duration::new(2, 0),
"{:?}",
start_1_3.elapsed()
);
let start_1_6 = Instant::now();
initializer.max_scan_batch_bytes = total_bytes / 6;
block_on(initializer.async_incremental_scan(snap.clone(), region.clone())).unwrap();
check_result();
// 4s to allow certain inaccuracy.
assert!(
start_1_6.elapsed() >= Duration::new(4, 0),
"{:?}",
start_1_6.elapsed()
);
initializer.build_resolver = false;
block_on(initializer.async_incremental_scan(snap.clone(), region.clone())).unwrap();
loop {
let task = rx.recv_timeout(Duration::from_millis(100));
match task {
Ok(t) => panic!("unepxected task {} received", t),
Err(RecvTimeoutError::Timeout) => break,
Err(e) => panic!("unexpected err {:?}", e),
}
}
// Test cancellation.
initializer.downstream_state.store(DownstreamState::Stopped);
block_on(initializer.async_incremental_scan(snap.clone(), region)).unwrap_err();
// Cancel error should trigger a deregsiter.
let mut region = Region::default();
region.set_id(initializer.region_id);
region.mut_peers().push(Default::default());
let snapshot = Some(RegionSnapshot::from_snapshot(snap, Arc::new(region)));
let resp = ReadResponse {
snapshot,
response: Default::default(),
txn_extra_op: Default::default(),
};
block_on(initializer.on_change_cmd_response(resp.clone())).unwrap_err();
drop(pool);
initializer.downstream_state.store(DownstreamState::Normal);
block_on(initializer.on_change_cmd_response(resp)).unwrap_err();
worker.stop();
} | rust_cleaned_test_functions.jsonl/41990 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36462,
20801,
91578,
368,
341,
286,
1077,
2730,
284,
19944,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
741,
310,
659,
2343,
9758,
3875,
2398,
310,
659,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_process_store_with_bad_additional_signer() {
solana_logger::setup();
let signer0_pubkey = solana_sdk::pubkey::new_rand();
let signer1_pubkey = solana_sdk::pubkey::new_rand();
let signer0_account = RefCell::new(AccountSharedData::default());
let signer1_account = RefCell::new(AccountSharedData::default());
let keys = vec![(signer0_pubkey, true)];
let (config_keypair, config_account) = create_config_account(keys.clone());
let config_pubkey = config_keypair.pubkey();
let my_config = MyConfig::new(42);
let instruction = config_instruction::store(&config_pubkey, true, keys, &my_config);
// Config-data pubkey doesn't match signer
let accounts = vec![
(true, false, &config_pubkey, &config_account),
(true, false, &signer1_pubkey, &signer1_account),
];
let keyed_accounts = create_keyed_accounts_unified(&accounts);
assert_eq!(
process_instruction(
&id(),
&instruction.data,
&mut MockInvokeContext::new(keyed_accounts)
),
Err(InstructionError::MissingRequiredSignature)
);
// Config-data pubkey not a signer
let accounts = vec![
(true, false, &config_pubkey, &config_account),
(false, false, &signer0_pubkey, &signer0_account),
];
let keyed_accounts = create_keyed_accounts_unified(&accounts);
assert_eq!(
process_instruction(
&id(),
&instruction.data,
&mut MockInvokeContext::new(keyed_accounts)
),
Err(InstructionError::MissingRequiredSignature)
);
} | rust_cleaned_test_functions.jsonl/4690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 846
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14809,
6615,
34199,
81742,
11172,
261,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
70039,
15,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bool_array_and_sliced_offset2() {
let a = BooleanArray::from(vec![false, false, true, true]);
let b = BooleanArray::from(vec![
false, false, false, false, false, false, false, false, false, true, false,
true,
]);
let b = b.slice(8, 4);
let b = b.as_any().downcast_ref::<BooleanArray>().unwrap();
let c = and(&a, &b).unwrap();
assert_eq!(4, c.len());
assert_eq!(false, c.value(0));
assert_eq!(false, c.value(1));
assert_eq!(false, c.value(2));
assert_eq!(true, c.value(3));
} | rust_cleaned_test_functions.jsonl/118983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
3858,
8378,
643,
74630,
6917,
17,
368,
341,
286,
1077,
264,
284,
6992,
1857,
486,
1499,
25592,
20703,
3849,
11,
895,
11,
830,
11,
830,
2558,
286,
1077,
293,
284,
6992,
1857,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_colon_sep() {
assert_eq!(dur(10, 4), parse_dur("10:04").unwrap());
assert_eq!(dur(10, 4), parse_dur("10:4").unwrap());
} | rust_cleaned_test_functions.jsonl/51535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10211,
263,
54775,
368,
341,
286,
2060,
10714,
10297,
70692,
7,
16,
15,
11,
220,
19,
701,
4715,
82289,
445,
16,
15,
25,
15,
19,
1827,
15454,
1423,
286,
2060,
10714,
10297,
70692,
7,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bytes() {
let cfg = PayloadConfig::default();
let mut req = TestRequest::with_header(header::CONTENT_LENGTH, "11").finish();
req.payload_mut()
.unread_data(Bytes::from_static(b"hello=world"));
match Bytes::from_request(&req, &cfg).poll().unwrap() {
Async::Ready(s) => {
assert_eq!(s, Bytes::from_static(b"hello=world"));
}
_ => unreachable!(),
}
} | rust_cleaned_test_functions.jsonl/75107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
368,
341,
286,
1077,
13286,
284,
52916,
2648,
486,
2258,
543,
286,
1077,
5206,
4232,
284,
3393,
1900,
486,
4197,
8757,
25534,
486,
67872,
15023,
11,
330,
16,
16,
1827,
30150,
543,
286,
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... | 2 |
#[test]
fn test_over_mounted() {
// Prefer the earlier entry if the devices are different but
// the mount directory is the same.
let m1 = mount_info("/dev/foo", "/", "/mnt/baz");
let m2 = mount_info("/dev/bar", "/", "/mnt/baz");
assert!(!mount_info_lt(&m1, &m2));
} | rust_cleaned_test_functions.jsonl/7061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15431,
57593,
291,
368,
341,
310,
442,
84468,
279,
6788,
4343,
421,
279,
7611,
525,
2155,
714,
198,
310,
442,
279,
6470,
6220,
374,
279,
1852,
624,
310,
1077,
296,
16,
284,
6470,
3109,
4283,
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_grid_constructor() {
let input = ".L.\n#L.\n...\nL#.";
let grid = Grid::new(input);
assert_eq!(grid.width, 3);
assert_eq!(grid.height, 4);
assert_eq!(
grid.cells,
vec![
Cell::Floor,
Cell::Seat(false),
Cell::Floor,
Cell::Seat(true),
Cell::Seat(false),
Cell::Floor,
Cell::Floor,
Cell::Floor,
Cell::Floor,
Cell::Seat(false),
Cell::Seat(true),
Cell::Floor
]
);
} | rust_cleaned_test_functions.jsonl/82210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15604,
66210,
368,
341,
262,
1077,
1946,
284,
5933,
43,
7110,
77,
2,
43,
7110,
77,
30801,
77,
43,
2,
15297,
262,
1077,
5827,
284,
10587,
486,
931,
5384,
626,
262,
2060,
10714,
10297,
4203,
544... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_registration_upload() -> Result<(), ProtocolError> {
let parameters = populate_test_vectors(&serde_json::from_str(TEST_VECTOR).unwrap());
let client_s_sk_and_nonce: Vec<u8> =
[parameters.client_s_sk, parameters.envelope_nonce].concat();
let mut finish_registration_rng = CycleRng::new(client_s_sk_and_nonce);
let result = ClientRegistration::<RistrettoSha5123dhNoSlowHash>::deserialize(
¶meters.client_registration_state[..],
)?
.finish(
&mut finish_registration_rng,
RegistrationResponse::deserialize(¶meters.registration_response[..])?,
ClientRegistrationFinishParameters::WithIdentifiers(parameters.id_u, parameters.id_s),
)?;
assert_eq!(
hex::encode(parameters.registration_upload),
hex::encode(result.message.serialize())
);
assert_eq!(
hex::encode(parameters.export_key),
hex::encode(result.export_key.to_vec())
);
Ok(())
} | rust_cleaned_test_functions.jsonl/27835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 409
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49101,
21691,
368,
1464,
5714,
68843,
24572,
1454,
29,
341,
262,
1077,
5029,
284,
30446,
4452,
49158,
2099,
47024,
9455,
486,
1499,
2895,
50320,
47993,
568,
15454,
5231,
262,
1077,
2943,
643,
33811,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_f64_desc() {
test_mem_compare!(
get_f64_samples(),
false,
encode_f64_desc,
decode_f64_desc,
write_f64_desc,
read_f64_desc,
);
} | rust_cleaned_test_functions.jsonl/56913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
21,
19,
10986,
368,
341,
286,
1273,
12976,
32235,
33673,
310,
633,
761,
21,
19,
18297,
3148,
310,
895,
345,
310,
16164,
761,
21,
19,
10986,
345,
310,
16895,
761,
21,
19,
10986,
345,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_safe_len() {
assert_eq!(42usize, safe_len(42usize).unwrap());
assert!(safe_len(1024 * 1024 * 1024).is_err());
} | rust_cleaned_test_functions.jsonl/84119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34067,
6043,
368,
341,
286,
2060,
10714,
10297,
19,
17,
51878,
11,
6092,
6043,
7,
19,
17,
51878,
568,
15454,
1423,
286,
2060,
10297,
18675,
6043,
7,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cannot_serialize_paths() {
let path = unsafe { str::from_utf8_unchecked(b"Hello \xF0\x90\x80World") };
assert_ser_tokens_error(
&Path::new(path),
&[],
"path contains invalid UTF-8 characters",
);
let mut path_buf = PathBuf::new();
path_buf.push(path);
assert_ser_tokens_error(&path_buf, &[], "path contains invalid UTF-8 characters");
} | rust_cleaned_test_functions.jsonl/6283 | {
"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,
666,
3401,
88686,
24152,
368,
341,
262,
1077,
1815,
284,
19860,
314,
607,
486,
1499,
39453,
23,
4907,
7549,
1883,
1,
9707,
1124,
9770,
15,
3462,
24,
15,
3462,
23,
15,
10134,
899,
2605,
262,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_frame() {
use std::io::Read;
let data = &[1u8, 2u8, 3u8, 4u8, 5u8];
let mut dec = Decoder::new(&data[..]).unwrap();
assert_eq!(
dec.read_to_end(&mut Vec::new()).err().map(|e| e.kind()),
Some(io::ErrorKind::Other),
"did not encounter expected 'invalid frame' error"
);
} | rust_cleaned_test_functions.jsonl/134370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
8929,
368,
341,
262,
990,
1460,
486,
815,
486,
4418,
401,
1066,
262,
1077,
821,
284,
44590,
16,
84,
23,
11,
220,
17,
84,
23,
11,
220,
18,
84,
23,
11,
220,
19,
84,
23,
11,
220,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exec_set_column() {
let header = make_test_header(EndianSlice::new(&[], LittleEndian));
let initial_registers = LineRow::new(&header);
let opcode = LineInstruction::SetColumn(42);
let mut expected_registers = initial_registers;
expected_registers.column = 42;
assert_exec_opcode(header, initial_registers, opcode, expected_registers, false);
} | rust_cleaned_test_functions.jsonl/3374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18430,
2602,
8744,
368,
341,
286,
1077,
4247,
284,
1281,
4452,
8757,
7,
43231,
33236,
486,
931,
2099,
12995,
14671,
43231,
1106,
286,
1077,
2856,
78360,
284,
7083,
3102,
486,
931,
2099,
2708,
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_range_small() {
let size = 5;
// Forwards
let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
let mut j = 0;
for ((&k, &v), i) in map.range(Included(&2), Unbounded).zip(2..size) {
assert_eq!(k, i);
assert_eq!(v, i);
j += 1;
}
assert_eq!(j, size - 2);
} | rust_cleaned_test_functions.jsonl/67292 | {
"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,
9698,
31966,
368,
341,
262,
1077,
1379,
284,
220,
20,
401,
262,
442,
1752,
4014,
198,
262,
1077,
2415,
25,
425,
6533,
2227,
27,
6878,
716,
29,
284,
320,
15,
496,
2141,
568,
2186,
22428,
72,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decoder_feed_after_finish() {
let mut d = GB18030Encoding.decoder();
assert_feed_ok!(d, [0xd2, 0xbb], [0xd2], "\u4e00");
assert_finish_err!(d, "");
assert_feed_ok!(d, [0xd2, 0xbb], [], "\u4e00");
assert_finish_ok!(d, "");
let mut d = GB18030Encoding.decoder();
assert_feed_ok!(d, [0x98, 0x35, 0xee, 0x37], [0x98, 0x35, 0xee], "\U0002a6a5");
assert_finish_err!(d, "");
assert_feed_ok!(d, [0x98, 0x35, 0xee, 0x37], [0x98, 0x35], "\U0002a6a5");
assert_finish_err!(d, "");
assert_feed_ok!(d, [0x98, 0x35, 0xee, 0x37], [0x98], "\U0002a6a5");
assert_finish_err!(d, "");
assert_feed_ok!(d, [0x98, 0x35, 0xee, 0x37], [], "\U0002a6a5");
assert_finish_ok!(d, "");
} | rust_cleaned_test_functions.jsonl/48117 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
42390,
19844,
42980,
368,
341,
286,
1077,
5206,
294,
284,
18865,
16,
23,
15,
18,
15,
14690,
74047,
543,
286,
2060,
42390,
19817,
10297,
67,
11,
508,
15,
9703,
17,
11,
220,
15,
48939,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stdw() {
test_interpreter_and_jit_asm!(
"
stdw [r1+2], 0x44332211
ldxdw r0, [r1+2]
exit",
[
0xaa, 0xbb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xcc, 0xdd,
],
(),
{ |_vm, res: Result| { res.unwrap() == 0x44332211 } },
3
);
} | rust_cleaned_test_functions.jsonl/58996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
86,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1460,
86,
508,
81,
16,
10,
17,
1125,
220,
15,
87,
19,
19,
18,
18,
17,
17,
16,
16,
198,
286,
261... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_active_stake_merge() {
let mut transaction_context = TransactionContext::new(Vec::new(), 1);
let invoke_context = InvokeContext::new_mock(&mut transaction_context, &[]);
let delegation_a = 4_242_424_242u64;
let delegation_b = 6_200_000_000u64;
let credits_a = 124_521_000u64;
let rent_exempt_reserve = 227_000_000u64;
let meta = Meta {
rent_exempt_reserve,
..Meta::default()
};
let stake_a = Stake {
delegation: Delegation {
stake: delegation_a,
..Delegation::default()
},
credits_observed: credits_a,
};
let stake_b = Stake {
delegation: Delegation {
stake: delegation_b,
..Delegation::default()
},
credits_observed: credits_a,
};
let activation_epoch_a = MergeKind::ActivationEpoch(meta, stake_a);
let activation_epoch_b = MergeKind::ActivationEpoch(meta, stake_b);
let new_stake = activation_epoch_a
.merge(&invoke_context, activation_epoch_b, None)
.unwrap()
.unwrap()
.stake()
.unwrap();
assert_eq!(new_stake.credits_observed, credits_a);
assert_eq!(
new_stake.delegation.stake,
delegation_a + delegation_b + rent_exempt_reserve
);
let fully_active_a = MergeKind::FullyActive(meta, stake_a);
let fully_active_b = MergeKind::FullyActive(meta, stake_b);
let new_stake = fully_active_a
.merge(&invoke_context, fully_active_b, None)
.unwrap()
.unwrap()
.stake()
.unwrap();
assert_eq!(new_stake.credits_observed, credits_a);
assert_eq!(new_stake.delegation.stake, delegation_a + delegation_b);
let credits_b = 125_124_521u64;
let stake_b = Stake {
delegation: Delegation {
stake: delegation_b,
..Delegation::default()
},
credits_observed: credits_b,
};
let activation_epoch_a = MergeKind::ActivationEpoch(meta, stake_a);
let activation_epoch_b = MergeKind::ActivationEpoch(meta, stake_b);
let new_stake = activation_epoch_a
.merge(&invoke_context, activation_epoch_b, None)
.unwrap()
.unwrap()
.stake()
.unwrap();
assert_eq!(
new_stake.credits_observed,
(credits_a * delegation_a + credits_b * (delegation_b + rent_exempt_reserve))
/ (delegation_a + delegation_b + rent_exempt_reserve)
+ 1
);
assert_eq!(
new_stake.delegation.stake,
delegation_a + delegation_b + rent_exempt_reserve
);
let fully_active_a = MergeKind::FullyActive(meta, stake_a);
let fully_active_b = MergeKind::FullyActive(meta, stake_b);
let new_stake = fully_active_a
.merge(&invoke_context, fully_active_b, None)
.unwrap()
.unwrap()
.stake()
.unwrap();
assert_eq!(
new_stake.credits_observed,
(credits_a * delegation_a + credits_b * delegation_b) / (delegation_a + delegation_b)
+ 1
);
assert_eq!(new_stake.delegation.stake, delegation_a + delegation_b);
let delegation = 1_000_000u64;
let credits_a = 200_000_000u64;
let credits_b = 100_000_000u64;
let rent_exempt_reserve = 227_000_000u64;
let meta = Meta {
rent_exempt_reserve,
..Meta::default()
};
let stake_a = Stake {
delegation: Delegation {
stake: delegation,
..Delegation::default()
},
credits_observed: credits_a,
};
let stake_b = Stake {
delegation: Delegation {
stake: delegation,
..Delegation::default()
},
credits_observed: credits_b,
};
let fully_active_a = MergeKind::FullyActive(meta, stake_a);
let fully_active_b = MergeKind::FullyActive(meta, stake_b);
let new_stake = fully_active_a
.merge(&invoke_context, fully_active_b, None)
.unwrap()
.unwrap()
.stake()
.unwrap();
assert_eq!(
new_stake.credits_observed,
(credits_a * delegation + credits_b * delegation) / (delegation + delegation)
);
assert_eq!(new_stake.delegation.stake, delegation * 2);
} | rust_cleaned_test_functions.jsonl/51815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2514
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12930,
1261,
726,
20888,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
17869,
1972,
486,
931,
49923,
486,
931,
1507,
220,
16,
317,
286,
1077,
19873,
8467,
284,
39667,
1972,
486,
931,
34134,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encryption() {
let seed = MaskSeed::generate();
assert_eq!(seed.as_slice().len(), 32);
assert_ne!(seed, MaskSeed::zeroed());
let EncryptKeyPair { public, secret } = EncryptKeyPair::generate();
let encr_seed = seed.encrypt(&public);
assert_eq!(encr_seed.as_slice().len(), 80);
let decr_seed = encr_seed.decrypt(&public, &secret).unwrap();
assert_eq!(seed, decr_seed);
} | rust_cleaned_test_functions.jsonl/39315 | {
"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,
13781,
15597,
368,
341,
286,
1077,
10320,
284,
19924,
41471,
486,
19366,
543,
286,
2060,
10714,
10297,
22602,
5357,
26488,
1005,
2892,
1507,
220,
18,
17,
317,
286,
2060,
13925,
10297,
22602,
11,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_branch() {
let mut strand: Counter = Counter { count: Value { x: 0 } };
let res = strand.evolve(&Increment);
assert!(res.is_ok());
let mut branch = strand.branch();
let res1 = strand.evolve(&Increment);
let res2 = branch.evolve(&Decrement);
assert!(res1.is_ok());
assert!(res2.is_ok());
assert_eq!(strand.count.x, 2);
assert_eq!(branch.count.x, 0);
} | rust_cleaned_test_functions.jsonl/42341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28031,
368,
341,
262,
1077,
5206,
41489,
25,
19735,
284,
19735,
314,
1760,
25,
5162,
314,
856,
25,
220,
15,
335,
2605,
262,
1077,
592,
284,
41489,
77343,
3948,
2099,
38311,
317,
262,
2060,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uint_into_int() {
let tests: Vec<(u64, FieldTypeTp, Option<i64>)> = vec![
(123, FieldTypeTp::Tiny, Some(123)),
(256, FieldTypeTp::Tiny, None),
(123, FieldTypeTp::Short, Some(123)),
(65536, FieldTypeTp::Short, None),
(123, FieldTypeTp::Int24, Some(123)),
(8388610, FieldTypeTp::Int24, None),
(8388610, FieldTypeTp::Long, Some(8388610)),
(4294967297, FieldTypeTp::Long, None),
(4294967297, FieldTypeTp::LongLong, Some(4294967297)),
(u64::MAX, FieldTypeTp::LongLong, None),
];
let mut ctx = EvalContext::default();
for (from, tp, to) in tests {
let r = from.to_int(&mut ctx, tp);
match to {
Some(to) => assert_eq!(to, r.unwrap()),
None => assert!(
r.is_err(),
"from: {}, to tp: {} should be overflow",
from,
tp
),
}
}
} | rust_cleaned_test_functions.jsonl/48524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 624
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
45514,
4042,
368,
341,
286,
1077,
7032,
25,
11312,
28706,
84,
21,
19,
11,
84614,
62241,
11,
6959,
21897,
21,
19,
9231,
29,
284,
7486,
90515,
310,
320,
16,
17,
18,
11,
84614,
62241,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_destroy_local_reader() {
// 3 nodes cluster.
let mut cluster = new_node_cluster(0, 3);
// Set election timeout and max leader lease to 1s.
configure_for_lease_read(&mut cluster, Some(100), Some(10));
let pd_client = cluster.pd_client.clone();
// Disable default max peer count check.
pd_client.disable_default_operator();
let r1 = cluster.run_conf_change();
let (key, value) = (b"k1", b"v1");
cluster.must_put(key, value);
assert_eq!(cluster.get(key), Some(value.to_vec()));
pd_client.must_add_peer(r1, new_peer(2, 2));
pd_client.must_add_peer(r1, new_peer(3, 3));
let epoch = pd_client.get_region_epoch(r1);
// Conf version must change.
assert!(epoch.get_conf_ver() > 2);
cluster.must_transfer_leader(1, new_peer(2, 2));
pd_client.must_remove_peer(r1, new_peer(1, 1));
// Make sure region 1 is removed from store 1.
cluster.must_region_not_exist(r1, 1);
let region = pd_client.get_region_by_id(r1).wait().unwrap().unwrap();
// Local reader panics if it finds a delegate.
let reader_has_delegate = "localreader_on_find_delegate";
fail::cfg(reader_has_delegate, "panic").unwrap();
let resp = read_on_peer(
&mut cluster,
new_peer(1, 1),
region,
key,
false,
Duration::from_secs(5),
);
debug!("resp: {:?}", resp);
assert!(resp.unwrap().get_header().has_error());
fail::remove(reader_has_delegate);
} | rust_cleaned_test_functions.jsonl/23133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 655
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18066,
13564,
22306,
368,
341,
262,
442,
220,
18,
7798,
10652,
624,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
626,
262,
442,
2573,
6223,
9632,
323,
1932,
7653,
25064,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_char() {
let vec = vec!['a', 'b', 'c', 'd', 'A', 'X', ' ', '#', 'Ö', 'Ä', 'µ', '€'];
check_round_trip(vec);
} | rust_cleaned_test_functions.jsonl/24194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9232,
368,
341,
262,
1077,
7486,
284,
7486,
0,
677,
64,
516,
364,
65,
516,
364,
66,
516,
364,
67,
516,
364,
32,
516,
364,
55,
516,
364,
6614,
5875,
516,
364,
63361,
516,
364,
86975,
516,
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 |
#[test]
fn test_try_drain_keys_found_in_lookup_table_with_empty_keys() {
let mut compiled_keys = CompiledKeys::default();
let lookup_table_addresses = vec![
Pubkey::new_unique(),
Pubkey::new_unique(),
Pubkey::new_unique(),
];
let drain_result =
compiled_keys.try_drain_keys_found_in_lookup_table(&lookup_table_addresses, |_| true);
assert_eq!(drain_result.as_ref().err(), None);
let (lookup_table_indexes, drained_keys) = drain_result.unwrap();
assert!(drained_keys.is_empty());
assert!(lookup_table_indexes.is_empty());
} | rust_cleaned_test_functions.jsonl/52072 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
26680,
466,
12631,
21480,
1243,
27464,
5237,
6615,
15124,
12631,
368,
341,
286,
1077,
5206,
19697,
12631,
284,
96471,
8850,
486,
2258,
1428,
286,
1077,
18615,
5237,
59471,
284,
7486,
90515,
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_git_pr_details_feature_branch() {
let result = get_pr_details(true);
assert_eq!(
result.0,
"As per ticket above, Product wants to improve this feature, hence we are ..."
);
assert_eq!(result.1, "Normal|Dark Mode|Accessibility |RTL\n---|---|---|---\n<img src= width=200 />|<img src= width=200 />|<img src= width=200 />|<img src= width=200 />\n");
} | rust_cleaned_test_functions.jsonl/49466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68801,
5294,
13260,
17069,
28031,
368,
341,
310,
1077,
1102,
284,
633,
5294,
13260,
3715,
626,
310,
2060,
10714,
33673,
394,
1102,
13,
15,
345,
394,
330,
2121,
817,
11727,
3403,
11,
5643,
6801,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proxy() {
let url = Url::parse("http://example.dom").unwrap();
let mut req = Request::with_connector(
Get, url, &mut MockConnector
).unwrap();
req.message.set_proxied(true);
let bytes = run_request(req);
let s = from_utf8(&bytes[..]).unwrap();
let request_line = "GET http://example.dom/ HTTP/1.1";
assert_eq!(&s[..request_line.len()], request_line);
assert!(s.contains("Host: example.dom"));
} | rust_cleaned_test_functions.jsonl/2070 | {
"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,
29712,
368,
341,
286,
1077,
2515,
284,
22840,
486,
6400,
445,
1254,
1110,
8687,
21435,
1827,
15454,
543,
286,
1077,
5206,
4232,
284,
6145,
486,
4197,
76393,
1006,
310,
2126,
11,
2515,
11,
609,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_nameservers_or_local() {
let config = resolv_conf::Config::new();
assert_eq!(
vec![
ScopedIp::from(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1))),
ScopedIp::from(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1))),
],
config.get_nameservers_or_local()
);
} | rust_cleaned_test_functions.jsonl/121167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9187,
18729,
8734,
13564,
368,
341,
262,
1077,
2193,
284,
592,
35315,
16059,
486,
2648,
486,
931,
543,
262,
2060,
10714,
33673,
286,
7486,
90515,
310,
98687,
23378,
486,
1499,
8972,
79,
1398... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_entry_duplicate_product() {
let mut batch = Batch::new();
batch
.add_entry(Entry::from_email(&Email::from_str(TEST_COOL_STR).unwrap()).unwrap())
.unwrap();
batch
.add_entry(Entry::from_email(&Email::from_str(TEST_DIF_ID).unwrap()).unwrap())
.unwrap();
let test_batch = Batch::test_second_email_str(TEST_DIF_ID); // Bath::test_second_email_str isn't smart like that
assert_eq!(batch, test_batch)
} | rust_cleaned_test_functions.jsonl/68294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
9078,
70434,
9840,
368,
341,
1789,
286,
1077,
5206,
7162,
284,
33904,
486,
931,
543,
286,
7162,
198,
310,
659,
718,
9078,
7,
5874,
486,
1499,
9172,
2099,
4781,
486,
1499,
2895,
50320,
1962... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mv_errors() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
let dir = "test_mv_errors_dir";
let file_a = "test_mv_errors_file_a";
let file_b = "test_mv_errors_file_b";
at.mkdir(dir);
at.touch(file_a);
at.touch(file_b);
scene
.ucmd()
.arg("-T")
.arg("-t")
.arg(dir)
.arg(file_a)
.arg(file_b)
.fails()
.stderr_contains("cannot be used with");
// err == mv: cannot overwrite directory ‘dir’ with non-directory
scene
.ucmd()
.arg("-T")
.arg(file_a)
.arg(dir)
.fails()
.stderr_is(format!(
"mv: error: cannot overwrite directory ‘{}’ with non-directory\n",
dir
));
// $ at.$ mv dir file
// err == mv: cannot overwrite non-directory ‘file’ with directory ‘dir’
assert!(!scene
.ucmd()
.arg(dir)
.arg(file_a)
.fails()
.stderr_str()
.is_empty());
} | rust_cleaned_test_functions.jsonl/41627 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 584
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
20196,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,
280,
262,
1077,
5419,
284,
330,
1944,
73187,
20196,
4334,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buf_writer_seek() {
let mut buf = [0 as u8; 8];
{
let mut writer = Cursor::new(&mut buf[..]);
assert_eq!(writer.position(), 0);
assert_eq!(writer.write(&[1]).unwrap(), 1);
assert_eq!(writer.position(), 1);
assert_eq!(writer.seek(SeekFrom::Start(2)).unwrap(), 2);
assert_eq!(writer.position(), 2);
assert_eq!(writer.write(&[2]).unwrap(), 1);
assert_eq!(writer.position(), 3);
assert_eq!(writer.seek(SeekFrom::Current(-2)).unwrap(), 1);
assert_eq!(writer.position(), 1);
assert_eq!(writer.write(&[3]).unwrap(), 1);
assert_eq!(writer.position(), 2);
assert_eq!(writer.seek(SeekFrom::End(-1)).unwrap(), 7);
assert_eq!(writer.position(), 7);
assert_eq!(writer.write(&[4]).unwrap(), 1);
assert_eq!(writer.position(), 8);
}
let b: &[_] = &[1, 3, 2, 0, 0, 0, 0, 4];
assert_eq!(buf, b);
} | rust_cleaned_test_functions.jsonl/4222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 542
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10363,
28908,
74473,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
438,
575,
23,
26,
220,
23,
935,
286,
341,
310,
1077,
5206,
6916,
284,
28067,
486,
931,
2099,
6984,
6607,
95874,
2558,
310,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_overload_method_in_super_class() {
errors(
"@open class A { @open fun f() {} }
class B extends A { fun f(a: Int32) {} }",
&[
(pos(2, 33), SemError::MissingOverride("f".into())),
(pos(2, 33), SemError::OverrideMismatch),
],
);
ok("@open class A { @static fun f() {} }
class B extends A { @static fun f(a: Int32) {} }");
} | rust_cleaned_test_functions.jsonl/128698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15431,
1078,
9032,
1243,
38886,
4790,
368,
341,
286,
5975,
1006,
310,
8428,
2508,
536,
362,
314,
569,
2508,
2464,
282,
368,
4687,
456,
310,
536,
425,
2239,
362,
314,
2464,
282,
2877,
25,
1333,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_score_clips() {
let x = b"AA";
let y = b"CC";
let base_score = Scoring::from_scores(-1, -1, 1, -1);
{
let scoring = Scoring {
xclip_prefix: 0,
yclip_prefix: 0,
..base_score.clone()
};
let mut al = Aligner::with_scoring(scoring);
let alignment = al.custom(x, y);
assert_eq!(alignment.score, 0);
}
{
let scoring = Scoring {
xclip_prefix: 0,
yclip_suffix: 0,
..base_score.clone()
};
let mut al = Aligner::with_scoring(scoring);
let alignment = al.custom(x, y);
assert_eq!(alignment.score, 0);
}
{
let scoring = Scoring {
xclip_suffix: 0,
yclip_prefix: 0,
..base_score.clone()
};
let mut al = Aligner::with_scoring(scoring);
let alignment = al.custom(x, y);
assert_eq!(alignment.score, 0);
}
{
let scoring = Scoring {
xclip_suffix: 0,
yclip_suffix: 0,
..base_score
};
let mut al = Aligner::with_scoring(scoring);
let alignment = al.custom(x, y);
assert_eq!(alignment.score, 0);
}
} | rust_cleaned_test_functions.jsonl/16857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 852
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
10405,
6794,
3077,
368,
341,
286,
1077,
856,
284,
293,
1,
6029,
876,
286,
1077,
379,
284,
293,
1,
3706,
876,
286,
1077,
2331,
10405,
284,
2463,
5503,
486,
1499,
27198,
4080,
16,
11,
481... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_elem_reduced() {
test::run(
test_file!("bigint_elem_reduced_tests.txt"),
|section, test_case| {
assert_eq!(section, "");
struct MM {}
unsafe impl SmallerModulus<MM> for M {}
unsafe impl NotMuchSmallerModulus<MM> for M {}
let m = consume_modulus::<M>(test_case, "M");
let expected_result = consume_elem(test_case, "R", &m);
let a =
consume_elem_unchecked::<MM>(test_case, "A", expected_result.limbs.len() * 2);
let actual_result = elem_reduced(&a, &m);
let oneRR = m.oneRR();
let actual_result = elem_mul(oneRR.as_ref(), actual_result, &m);
assert_elem_eq(&actual_result, &expected_result);
Ok(())
},
)
} | rust_cleaned_test_functions.jsonl/55428 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28179,
1288,
53378,
368,
341,
286,
1273,
486,
6108,
1006,
310,
1273,
2458,
17223,
84674,
28179,
1288,
53378,
32509,
3909,
4461,
310,
760,
2809,
11,
1273,
19096,
91,
341,
394,
2060,
10714,
10297,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_acos() {
let tests = vec![
(
ScalarFuncSig::Acos,
Datum::F64(0f64),
f64::consts::PI / 2.0_f64,
),
(ScalarFuncSig::Acos, Datum::F64(1f64), 0.0_f64),
(ScalarFuncSig::Acos, Datum::F64(-1f64), f64::consts::PI),
(
ScalarFuncSig::Acos,
Datum::F64(f64::consts::SQRT_2 / 2.0_f64),
f64::consts::PI / 4.0_f64,
),
];
let tests_invalid_f64 = vec![
(ScalarFuncSig::Acos, Datum::F64(f64::INFINITY), Datum::Null),
(ScalarFuncSig::Acos, Datum::F64(f64::NAN), Datum::Null),
(ScalarFuncSig::Acos, Datum::F64(2f64), Datum::Null),
(ScalarFuncSig::Acos, Datum::F64(-2f64), Datum::Null),
];
let mut ctx = EvalContext::default();
for (sig, arg, exp) in tests {
let arg = datum_expr(arg);
let f = scalar_func_expr(sig, &[arg]);
let op = Expression::build(&mut ctx, f).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
assert!((got.f64() - exp).abs() < f64::EPSILON);
}
for (sig, arg, exp) in tests_invalid_f64 {
let arg = datum_expr(arg);
let f = scalar_func_expr(sig, &[arg]);
let op = Expression::build(&mut ctx, f).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/125535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 905
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14718,
436,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
2399,
394,
35176,
9626,
47246,
486,
32,
9407,
345,
394,
68459,
486,
37,
21,
19,
7,
15,
69,
21,
19,
1326,
394,
282,
21,
19,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_unicode_chars_2() {
let mut args = Arguments::new("Saighdiúr réalta what even");
assert_eq!(Some("Saighdiúr"), args.next());
assert_eq!(Some("réalta"), args.next());
assert_eq!(Some("what"), args.next());
assert_eq!(Some("even"), args.next());
assert_eq!(None, args.next());
} | rust_cleaned_test_functions.jsonl/53184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54662,
37418,
62,
17,
368,
341,
286,
1077,
5206,
2827,
284,
27702,
486,
931,
445,
52279,
1090,
8579,
6654,
81,
58057,
2565,
1128,
1496,
797,
286,
2060,
10714,
10297,
8373,
445,
52279,
1090,
8579,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_merges() {
for prefix_bit_len in bit_lengths() {
let mut single = DenseHll::new(prefix_bit_len);
let mut merged = DenseHll::new(prefix_bit_len);
let mut current = DenseHll::new(prefix_bit_len);
for i in 0..1_000_000 {
if i % 10_000 == 0 {
merged.merge_with(¤t);
current = DenseHll::new(prefix_bit_len);
}
let mut hasher = XxHash64::default();
hasher.write_i32(i);
let h = hasher.finish();
current.insert_hash(h);
single.insert_hash(h);
}
merged.merge_with(¤t);
for i in 0..number_of_buckets(prefix_bit_len) {
assert_eq!(single.get_value(i), merged.get_value(i));
}
assert_eq!(single.cardinality(), merged.cardinality());
}
} | rust_cleaned_test_functions.jsonl/78015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 647
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
717,
2375,
288,
368,
341,
310,
369,
9252,
13996,
6043,
304,
2699,
54416,
368,
341,
394,
1077,
5206,
3175,
284,
42522,
39,
654,
486,
931,
28918,
13996,
6043,
317,
394,
1077,
5206,
26001,
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... | 5 |
#[test]
fn test_get_cursor_position() {
use CursorPosition::*;
let tests = &[("hi", 0, OnWordLeftEdge(0)),
("hi", 1, InWord(0)),
("hi", 2, OnWordRightEdge(0)),
("abc abc", 4, InSpace(Some(0), Some(1))),
("abc abc", 5, OnWordLeftEdge(1)),
("abc abc", 6, InWord(1)),
("abc abc", 8, OnWordRightEdge(1)),
(" a", 0, InSpace(None, Some(0))),
("a ", 2, InSpace(Some(0), None))];
for t in tests {
assert_cursor_pos(t.0, t.1, t.2);
}
} | rust_cleaned_test_functions.jsonl/29125 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
28601,
9661,
368,
341,
262,
990,
28067,
3812,
79304,
262,
1077,
7032,
284,
44590,
445,
6023,
497,
220,
15,
11,
1913,
10879,
5415,
11656,
7,
15,
6965,
1698,
3489,
6023,
497,
220,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_same_size() {
let haystack = "111 a 111b".to_string();
let needle = "111 a 1 1b";
search_test!(&haystack, needle, None);
} | rust_cleaned_test_functions.jsonl/19401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33574,
2368,
368,
341,
286,
1077,
88447,
284,
330,
16,
16,
16,
264,
220,
16,
16,
16,
65,
3263,
983,
3904,
543,
286,
1077,
30309,
284,
330,
16,
16,
16,
264,
220,
16,
220,
16,
65,
876,
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 |
#[test]
fn test_hit_and_miss() {
let cache = CacheTest::new(CACHE_SIZE);
assert_eq!(None, cache.look_up(100));
cache.insert(100, 101);
assert_eq!(Some(101), cache.look_up(100));
assert_eq!(None, cache.look_up(200));
assert_eq!(None, cache.look_up(300));
cache.insert(200, 201);
assert_eq!(Some(101), cache.look_up(100));
assert_eq!(Some(201), cache.look_up(200));
assert_eq!(None, cache.look_up(300));
cache.insert(100, 102);
assert_eq!(Some(102), cache.look_up(100));
assert_eq!(Some(201), cache.look_up(200));
assert_eq!(None, cache.look_up(300));
assert_eq!(1, cache.deleted_keys.borrow().len());
cache.assert_deleted_keys_and_values(0, (100, 101));
} | rust_cleaned_test_functions.jsonl/82675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37697,
8378,
67722,
368,
341,
286,
1077,
6500,
284,
19479,
2271,
486,
931,
3025,
17810,
4098,
317,
286,
2060,
10714,
10297,
4064,
11,
6500,
73034,
8237,
7,
16,
15,
15,
3237,
286,
6500,
7030,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cell_state_filter_ops() {
for &state_count in STATE_COUNT_TEST_VALUES {
let mut f = compile_test_fn(&format!(
"@states {}
@function CellFilter test(CellFilter l, CellFilter r, Int op) {{
if op == 0 {{ return l & r }}
if op == 1 {{ return l | r }}
if op == 2 {{ return l ^ r }}
if op == 3 {{ return ~l }}
}}",
state_count,
));
for (&cell_state1, &cell_state2) in iproduct!(test_values(), test_values()) {
if cell_state1 as usize >= state_count || cell_state2 as usize >= state_count {
continue;
}
let f1 = CellStateFilter::single_cell_state(state_count, cell_state1);
let f2 = CellStateFilter::single_cell_state(state_count, cell_state2);
let arg1 = ConstValue::CellStateFilter(f1.clone());
let arg2 = ConstValue::CellStateFilter(f2.clone());
assert_fn_result(
&mut f,
&mut [arg1.clone(), arg2.clone(), ConstValue::Int(0)],
Ok(ConstValue::CellStateFilter(f1.clone() & f2.clone())),
);
assert_fn_result(
&mut f,
&mut [arg1.clone(), arg2.clone(), ConstValue::Int(1)],
Ok(ConstValue::CellStateFilter(f1.clone() | f2.clone())),
);
assert_fn_result(
&mut f,
&mut [arg1.clone(), arg2.clone(), ConstValue::Int(2)],
Ok(ConstValue::CellStateFilter(f1.clone() ^ f2.clone())),
);
assert_fn_result(
&mut f,
&mut [arg1.clone(), arg2.clone(), ConstValue::Int(3)],
Ok(ConstValue::CellStateFilter(!f1.clone())),
);
}
}
} | rust_cleaned_test_functions.jsonl/16440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 993
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16648,
4387,
8727,
21959,
368,
341,
262,
369,
609,
2454,
3180,
304,
22425,
14672,
11641,
58662,
341,
286,
1077,
5206,
282,
284,
19192,
4452,
15246,
2099,
2243,
33673,
310,
8428,
32069,
5613,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_wikipedia() {
let (dist, len, lcs) = lcs("kitten", "sitting");
assert_eq!(dist, 5);
assert_eq!(len, 4);
assert_eq!(lcs, "ittn");
} | rust_cleaned_test_functions.jsonl/2912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
14939,
368,
341,
286,
1077,
320,
12211,
11,
2422,
11,
326,
4837,
8,
284,
326,
4837,
445,
74,
22449,
497,
330,
82,
14810,
797,
286,
2060,
10714,
10297,
12211,
11,
220,
20,
317,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_repeat() {
let gil = Python::acquire_gil();
let py = gil.python();
let d = [("ByteSequence", py.get_type::<ByteSequence>())].into_py_dict(py);
let run = |code| py.run(code, None, Some(d)).unwrap();
let err = |code| py.run(code, None, Some(d)).unwrap_err();
run("s1 = ByteSequence([1, 2, 3]); s2 = s1*2; assert list(s2) == [1, 2, 3, 1, 2, 3]");
err("s1 = ByteSequence([1, 2, 3]); s2 = s1*-1; assert list(s2) == [1, 2, 3, 1, 2, 3]");
} | rust_cleaned_test_functions.jsonl/64051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41975,
368,
341,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
1428,
262,
1077,
294,
284,
84019,
7153,
14076,
497,
4510,
670,
1819,
27638... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_zst() {
use std::cmp::Ordering;
struct Bad;
impl PartialEq for Bad {
fn eq(&self, _: &Self) -> bool {
false
}
}
impl Eq for Bad {}
impl PartialOrd for Bad {
fn partial_cmp(&self, _: &Self) -> Option<Ordering> {
Some(Ordering::Less)
}
}
impl Ord for Bad {
fn cmp(&self, _: &Self) -> Ordering {
Ordering::Less
}
}
let mut m = BTreeMap::new();
for _ in 0..100 {
m.insert(Bad, Bad);
}
} | rust_cleaned_test_functions.jsonl/49398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
6415,
267,
368,
341,
262,
990,
1460,
486,
7293,
486,
4431,
287,
401,
262,
2036,
11461,
401,
262,
11605,
55039,
369,
11461,
341,
286,
5168,
8939,
2099,
721,
11,
58536,
609,
12092,
8,
1464,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_integration_3() {
use crate::coprocessor::dag::rpn_expr::impl_arithmetic::{arithmetic_fn_meta, IntIntPlus};
use crate::coprocessor::dag::rpn_expr::impl_op::is_null_fn_meta;
// | col0 | col1 | col2 |
// | -10 | NULL | -5 |
// | -1 | NULL | NULL |
// | NULL | 1 | 4 |
let src_exec = make_src_executor();
let mut exec = BatchTopNExecutor::new_for_test(
src_exec,
vec![
RpnExpressionBuilder::new()
.push_column_ref(0)
.push_fn_call(is_null_fn_meta::<Int>(), FieldTypeTp::LongLong)
.build(),
RpnExpressionBuilder::new().push_column_ref(0).build(),
RpnExpressionBuilder::new()
.push_column_ref(1)
.push_constant(1)
.push_fn_call(arithmetic_fn_meta::<IntIntPlus>(), FieldTypeTp::LongLong)
.build(),
],
vec![false, false, true],
5,
);
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert_eq!(r.physical_columns.rows_len(), 0);
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert_eq!(r.physical_columns.rows_len(), 0);
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert_eq!(&r.logical_rows, &[0, 1, 2, 3, 4]);
assert_eq!(r.physical_columns.rows_len(), 5);
assert_eq!(r.physical_columns.columns_len(), 3);
assert_eq!(
r.physical_columns[0].decoded().as_int_slice(),
&[Some(-10), Some(-10), Some(-10), Some(-1), None]
);
assert_eq!(
r.physical_columns[1].decoded().as_int_slice(),
&[Some(10), Some(-10), None, None, Some(1)]
);
assert_eq!(
r.physical_columns[2].decoded().as_real_slice(),
&[
Real::new(3.0).ok(),
Real::new(0.0).ok(),
Real::new(-5.0).ok(),
None,
Real::new(4.0).ok()
]
);
assert!(r.is_drained.unwrap());
} | rust_cleaned_test_functions.jsonl/23911 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90250,
62,
18,
368,
341,
286,
990,
17717,
486,
37728,
40848,
269,
486,
50641,
486,
81,
19958,
21915,
486,
6383,
25842,
25922,
22964,
277,
25922,
15246,
13381,
11,
1333,
1072,
21807,
2440,
286,
990... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_style_from_str() {
let actual_style = Style::from_str(
"red green bold",
None,
Some("ol red box bold green ul"),
true,
false,
);
let red_green_bold = ansi_term::Style {
foreground: Some(ansi_term::Color::Red),
background: Some(ansi_term::Color::Green),
is_bold: true,
..ansi_term::Style::new()
};
assert_eq!(
actual_style,
Style {
ansi_term_style: red_green_bold,
decoration_style: DecorationStyle::BoxWithUnderOverline(red_green_bold),
..Style::new()
}
)
} | rust_cleaned_test_functions.jsonl/129645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15117,
5673,
2895,
368,
341,
286,
1077,
5042,
15117,
284,
11913,
486,
1499,
2895,
1006,
310,
330,
1151,
6176,
13939,
756,
310,
2240,
345,
310,
4329,
445,
337,
2518,
3745,
13939,
6176,
8557,
4461,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_duplicate_confirmed_dead_duplicate() {
let slot = 0;
let correct_hash = Hash::new_unique();
// Cluster has duplicate_confirmed some version of the slot
let cluster_duplicate_confirmed_hash = Some(&correct_hash);
// Our version of the slot is dead
let is_dead = true;
let bank_frozen_hash = Hash::default();
// and repair the correct version
let mut is_slot_duplicate = false;
assert_eq!(
on_cluster_update(
slot,
&bank_frozen_hash,
cluster_duplicate_confirmed_hash,
is_slot_duplicate,
is_dead
),
vec![
ResultingStateChange::MarkSlotDuplicate(bank_frozen_hash),
ResultingStateChange::RepairDuplicateConfirmedVersion(correct_hash),
]
);
is_slot_duplicate = true;
assert_eq!(
on_cluster_update(
slot,
&bank_frozen_hash,
cluster_duplicate_confirmed_hash,
is_slot_duplicate,
is_dead
),
vec![
ResultingStateChange::MarkSlotDuplicate(bank_frozen_hash),
ResultingStateChange::RepairDuplicateConfirmedVersion(correct_hash),
]
);
} | rust_cleaned_test_functions.jsonl/48612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 769
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70434,
16059,
8434,
53427,
70434,
368,
341,
286,
1077,
9446,
284,
220,
15,
280,
286,
1077,
4396,
8950,
284,
6531,
486,
931,
21218,
543,
286,
442,
35380,
702,
22513,
16059,
8434,
1045,
2319,
315,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_floating_ip_create_delete() {
let os = set_up();
let floating_network_id = env::var("RUST_OPENSTACK_FLOATING_NETWORK")
.expect("Missing RUST_OPENSTACK_FLOATING_NETWORK");
let mut floating_ip = os
.new_floating_ip(floating_network_id)
.create()
.expect("Cannot create a floating IP");
assert!(!floating_ip.is_associated());
floating_ip.port().err().unwrap();
let net = floating_ip
.floating_network()
.expect("Cannot find floating network");
let floating_ip_found = os
.find_floating_ips()
.with_floating_network(net.name().clone().expect("Floating network has no name"))
.into_iter()
.find(|ip| Ok(ip.id() == floating_ip.id()))
.expect("Cannot list floating IPs")
.expect("Floating IP was not found");
assert_eq!(floating_ip_found.id(), floating_ip.id());
floating_ip.refresh().expect("Cannot refresh a floating IP");
floating_ip
.delete()
.expect("Cannot request floating IP deletion")
.wait()
.expect("Floating IP was not deleted");
} | rust_cleaned_test_functions.jsonl/84688 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
28493,
10385,
8657,
11353,
368,
341,
262,
1077,
2643,
284,
738,
8237,
543,
262,
1077,
19057,
20966,
842,
284,
6105,
486,
947,
445,
49,
8553,
24070,
44976,
21496,
1718,
48119,
1138,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator_enumerate_nth_back() {
let xs = [0, 1, 2, 3, 4, 5];
let mut it = xs.iter().enumerate();
while let Some((i, &x)) = it.nth_back(0) {
assert_eq!(i, x);
}
let mut it = xs.iter().enumerate();
while let Some((i, &x)) = it.nth_back(1) {
assert_eq!(i, x);
}
let (i, &x) = xs.iter().enumerate().nth_back(3).unwrap();
assert_eq!(i, x);
assert_eq!(i, 2);
} | rust_cleaned_test_functions.jsonl/70151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
6205,
3389,
349,
78342,
3895,
368,
341,
262,
1077,
11943,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
5206,
432,
284,
11943,
19471,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_drain_iterator() {
let mut map = VecMap::new();
map.insert(1, "a");
map.insert(3, "c");
map.insert(2, "b");
let vec: Vec<_> = map.drain().collect();
assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
assert_eq!(map.len(), 0);
} | rust_cleaned_test_functions.jsonl/53275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
466,
13491,
368,
341,
286,
1077,
5206,
2415,
284,
11312,
2227,
486,
931,
543,
286,
2415,
7030,
7,
16,
11,
330,
64,
797,
286,
2415,
7030,
7,
18,
11,
330,
66,
797,
286,
2415,
7030,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_invalid_config_file_path() {
let mut setting = DefaultSetting::new(TestConfigData { value: 3 }, Some("nuthatch"));
assert_eq!(setting.get_default_value().value, 3);
} | rust_cleaned_test_functions.jsonl/49675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
31433,
5332,
2458,
2638,
368,
341,
286,
1077,
5206,
6243,
284,
7899,
15400,
486,
931,
31159,
2648,
1043,
314,
897,
25,
220,
18,
2470,
4329,
445,
77,
940,
754,
14929,
286,
2060,
10714,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_eq() {
let a = Buffer::from(vec![1, 2, 3, 4, 5]);
let b = Buffer::from(vec![5, 4, 3, 2, 1]);
let c = a.iter()
.zip(b.iter())
.map(|(a, b)| a == b)
.collect::<Vec<bool>>();
assert_eq!(c, vec![false, false, true, false, false]);
} | rust_cleaned_test_functions.jsonl/37695 | {
"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,
7776,
10714,
368,
341,
286,
1077,
264,
284,
10312,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
2558,
286,
1077,
293,
284,
10312,
486,
1499,
25592,
20703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_of_recursive_type_enum() {
let schema = r#"
{
"type": "record",
"name": "User",
"namespace": "office",
"fields": [
{
"name": "details",
"type": [
{
"type": "record",
"name": "Employee",
"fields": [
{
"name": "gender",
"type": {
"type": "enum",
"name": "Gender",
"symbols": [
"male",
"female"
]
},
"default": "female"
}
]
},
{
"type": "record",
"name": "Manager",
"fields": [
{
"name": "gender",
"type": "Gender"
}
]
}
]
}
]
}
"#;
let schema = Schema::parse_str(schema).unwrap();
let schema_str = schema.canonical_form();
let expected = r#"{"name":"office.User","type":"record","fields":[{"name":"details","type":[{"name":"Employee","type":"record","fields":[{"name":"gender","type":{"name":"Gender","type":"enum","symbols":["male","female"]}}]},{"name":"Manager","type":"record","fields":[{"name":"gender","type":{"name":"Gender","type":"enum","symbols":["male","female"]}}]}]}]}"#;
assert_eq!(schema_str, expected);
} | rust_cleaned_test_functions.jsonl/108437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1053
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
3575,
66242,
1819,
31054,
368,
341,
286,
1077,
10802,
284,
435,
2,
698,
262,
341,
286,
330,
1313,
788,
330,
8548,
756,
286,
330,
606,
788,
330,
1474,
756,
286,
330,
2231,
788,
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_lldxdw() {
test_interpreter_and_jit_asm!(
"
ldxdw r0, [r1+2]
exit",
[
0xaa, 0xbb, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
0x77, 0x88, 0xcc, 0xdd,
],
(),
{ |_vm, res: Result| { res.unwrap() == 0x8877665544332211 } },
2
);
} | rust_cleaned_test_functions.jsonl/58985 | {
"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,
907,
507,
9703,
86,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
26129,
9703,
86,
435,
15,
11,
508,
81,
16,
10,
17,
921,
286,
4869,
756,
286,
2278,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_many() {
let (_accounts_dirs, paths) = get_temp_accounts_paths(2).unwrap();
let db = AccountsDB::new(paths);
let mut pubkeys: Vec<Pubkey> = vec![];
create_account(&db, &mut pubkeys, 0, 100, 0, 0);
check_accounts(&db, &pubkeys, 0, 100, 1);
} | rust_cleaned_test_functions.jsonl/33668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
22101,
368,
341,
286,
1077,
5453,
26206,
44869,
11,
12716,
8,
284,
633,
11771,
55665,
24152,
7,
17,
568,
15454,
543,
286,
1077,
2927,
284,
40655,
3506,
486,
931,
54728,
317,
286,
1077,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_signature_from() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let source_block_signature = mc_transaction_core::BlockSignature::new(
Ed25519Signature::new([1; 64]),
(&Ed25519Private::from_random(&mut rng)).into(),
31337,
);
let block_signature = blockchain::BlockSignature::from(&source_block_signature);
assert_eq!(
block_signature.get_signature().get_data(),
source_block_signature.signature().as_ref()
);
assert_eq!(
block_signature.get_signer().get_data(),
source_block_signature.signer().to_bytes().as_slice(),
);
assert_eq!(
block_signature.get_signed_at(),
source_block_signature.signed_at(),
);
} | rust_cleaned_test_functions.jsonl/57758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
39859,
5673,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17,
10149,
286,
1077,
2530,
7113,
39859,
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_duplicate_detect() {
let storage = TestStorageBuilder::new(DummyLockManager {}, false)
.build()
.unwrap();
let mut data = vec![];
for i in 0..1000 {
let key = format!("{}", i);
let value = format!("{}", i);
data.push((key.as_bytes().to_vec(), value.as_bytes().to_vec()))
}
write_data(&storage, data, 3);
let mut data = vec![];
let big_value = vec![1u8; 300];
for i in 0..1000 {
let key = format!("{}", i * 2);
data.push((key.as_bytes().to_vec(), big_value.clone()))
}
write_data(&storage, data, 5);
// We have to do the prewrite manually so that the mem locks don't get released.
let snapshot = storage.get_snapshot();
let start = format!("{}", 0);
let end = format!("{}", 800);
let detector = DuplicateDetector::new(
snapshot,
start.as_bytes().to_vec(),
Some(end.as_bytes().to_vec()),
0,
false,
)
.unwrap();
let mut expected_kvs = vec![];
for i in 0..400 {
let key = format!("{}", i * 2);
let value = format!("{}", i * 2);
expected_kvs.push((key.as_bytes().to_vec(), big_value.clone(), 5));
expected_kvs.push((key.as_bytes().to_vec(), value.as_bytes().to_vec(), 3));
}
expected_kvs.sort_by(|a, b| {
if a.0 == b.0 {
b.2.cmp(&a.2)
} else {
a.0.cmp(&b.0)
}
});
check_duplicate_data(detector, expected_kvs);
} | rust_cleaned_test_functions.jsonl/108496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 901
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70434,
56457,
368,
341,
286,
1077,
5819,
284,
3393,
5793,
3297,
486,
931,
5432,
8574,
11989,
2043,
16452,
895,
340,
310,
659,
5834,
741,
310,
659,
15454,
543,
286,
1077,
5206,
821,
284,
7486,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_igmp_integration_with_local_join_leave() {
// Simple IGMP integration test to check that when we call top-level
let mut ctx = setup_simple_test_environment();
assert_eq!(ctx.igmp_join_group(DummyLinkDeviceId, GROUP_ADDR), GroupJoinResult::Joined(()));
assert_gmp_state!(ctx, &GROUP_ADDR, Delaying);
assert_eq!(ctx.frames().len(), 1);
assert_eq!(ctx.timers().len(), 1);
ensure_ttl_ihl_rtr(&ctx);
assert_eq!(
ctx.igmp_join_group(DummyLinkDeviceId, GROUP_ADDR),
GroupJoinResult::AlreadyMember
);
assert_gmp_state!(ctx, &GROUP_ADDR, Delaying);
assert_eq!(ctx.frames().len(), 1);
assert_eq!(ctx.timers().len(), 1);
assert_eq!(
ctx.igmp_leave_group(DummyLinkDeviceId, GROUP_ADDR),
GroupLeaveResult::StillMember
);
assert_gmp_state!(ctx, &GROUP_ADDR, Delaying);
assert_eq!(ctx.frames().len(), 1);
assert_eq!(ctx.timers().len(), 1);
assert_eq!(ctx.igmp_leave_group(DummyLinkDeviceId, GROUP_ADDR), GroupLeaveResult::Left(()));
assert_eq!(ctx.frames().len(), 2);
assert_eq!(ctx.timers().len(), 0);
ensure_ttl_ihl_rtr(&ctx);
} | rust_cleaned_test_functions.jsonl/128916 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 610
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
343,
1307,
90250,
6615,
13564,
31017,
62666,
368,
341,
286,
442,
8993,
46180,
5781,
17590,
1273,
311,
1779,
429,
979,
582,
1618,
1909,
11591,
198,
23459,
286,
1077,
5206,
5635,
284,
6505,
3001... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_high_card_can_be_low_card_in_an_otherwise_tie() {
// down to last card
test(&["3S 5H 6S 8D 7H", "2S 5D 6D 8C 7S"], &["3S 5H 6S 8D 7H"])
} | rust_cleaned_test_functions.jsonl/49897 | {
"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,
22680,
16888,
27421,
21263,
23767,
16888,
1243,
12008,
30456,
4482,
528,
645,
368,
341,
1066,
262,
442,
1495,
311,
1537,
3701,
198,
262,
1273,
2099,
1183,
18,
50,
220,
20,
39,
220,
21,
50,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_faucet_request() {
let to = Pubkey::new_rand();
let blockhash = Hash::new(&to.as_ref());
let lamports = 50;
let req = FaucetRequest::GetAirdrop {
lamports,
blockhash,
to,
};
let req = serialize(&req).unwrap();
let mut bytes = BytesMut::with_capacity(req.len());
bytes.put(&req[..]);
let keypair = Keypair::new();
let expected_instruction = system_instruction::transfer(&keypair.pubkey(), &to, lamports);
let message = Message::new(&[expected_instruction], Some(&keypair.pubkey()));
let expected_tx = Transaction::new(&[&keypair], message, blockhash);
let expected_bytes = serialize(&expected_tx).unwrap();
let mut expected_vec_with_length = vec![0; 2];
LittleEndian::write_u16(&mut expected_vec_with_length, expected_bytes.len() as u16);
expected_vec_with_length.extend_from_slice(&expected_bytes);
let mut faucet = Faucet::new(keypair, None, None, None);
let response = faucet.process_faucet_request(&bytes);
let response_vec = response.unwrap().to_vec();
assert_eq!(expected_vec_with_length, response_vec);
let mut bad_bytes = BytesMut::with_capacity(9);
bad_bytes.put("bad bytes");
assert!(faucet.process_faucet_request(&bad_bytes).is_err());
} | rust_cleaned_test_functions.jsonl/117726 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 606
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
761,
20436,
295,
7893,
368,
341,
286,
1077,
311,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
2504,
8296,
284,
6531,
486,
931,
2099,
983,
5357,
7793,
1423,
286,
1077,
31603,
3394,
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_parse_svg2() {
let path =
BezPath::from_svg("M3.5 8a.5.5 0 01.5-.5h8a.5.5 0 010 1H4a.5.5 0 01-.5-.5z").unwrap();
assert_eq!(path.segments().count(), 6);
} | rust_cleaned_test_functions.jsonl/46304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
76849,
17,
368,
341,
286,
1077,
1815,
4035,
310,
96889,
1820,
486,
1499,
76849,
445,
44,
18,
13,
20,
220,
23,
64,
13,
20,
13,
20,
220,
15,
220,
15,
16,
13,
20,
14523,
20,
71,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_blocks_by_range_chunked_rpc() {
// set up the logging. The level and enabled logging or not
let log_level = Level::Trace;
let enable_logging = false;
let messages_to_send = 10;
let log = common::build_log(log_level, enable_logging);
// get sender/receiver
let (mut sender, mut receiver) = common::build_node_pair(&log, 10505);
// BlocksByRange Request
let rpc_request = RPCRequest::BlocksByRange(BlocksByRangeRequest {
head_block_root: Hash256::from_low_u64_be(0),
start_slot: 0,
count: messages_to_send,
step: 0,
});
// BlocksByRange Response
let rpc_response = RPCResponse::BlocksByRange(vec![13, 13, 13]);
let sender_request = rpc_request.clone();
let sender_log = log.clone();
let sender_response = rpc_response.clone();
// keep count of the number of messages received
let messages_received = Arc::new(Mutex::new(0));
// build the sender future
let sender_future = future::poll_fn(move || -> Poll<bool, ()> {
loop {
match sender.poll().unwrap() {
Async::Ready(Some(Libp2pEvent::PeerDialed(peer_id))) => {
// Send a BlocksByRange request
warn!(sender_log, "Sender sending RPC request");
sender
.swarm
.send_rpc(peer_id, RPCEvent::Request(1, sender_request.clone()));
}
Async::Ready(Some(Libp2pEvent::RPC(_, event))) => match event {
// Should receive the RPC response
RPCEvent::Response(id, response) => {
warn!(sender_log, "Sender received a response");
assert_eq!(id, 1);
match response {
RPCErrorResponse::Success(res) => {
assert_eq!(res, sender_response.clone());
*messages_received.lock().unwrap() += 1;
warn!(sender_log, "Chunk received");
}
RPCErrorResponse::StreamTermination(
ResponseTermination::BlocksByRange,
) => {
// should be exactly 10 messages before terminating
assert_eq!(*messages_received.lock().unwrap(), messages_to_send);
// end the test
return Ok(Async::Ready(true));
}
_ => panic!("Invalid RPC received"),
}
}
_ => panic!("Received invalid RPC message"),
},
Async::Ready(Some(_)) => {}
Async::Ready(None) | Async::NotReady => return Ok(Async::NotReady),
};
}
});
// build the receiver future
let receiver_future = future::poll_fn(move || -> Poll<bool, ()> {
loop {
match receiver.poll().unwrap() {
Async::Ready(Some(Libp2pEvent::RPC(peer_id, event))) => match event {
// Should receive the sent RPC request
RPCEvent::Request(id, request) => {
assert_eq!(id, 1);
assert_eq!(rpc_request.clone(), request);
// send the response
warn!(log, "Receiver got request");
for _ in 1..=messages_to_send {
receiver.swarm.send_rpc(
peer_id.clone(),
RPCEvent::Response(
id,
RPCErrorResponse::Success(rpc_response.clone()),
),
);
}
// send the stream termination
receiver.swarm.send_rpc(
peer_id,
RPCEvent::Response(
id,
RPCErrorResponse::StreamTermination(
ResponseTermination::BlocksByRange,
),
),
);
}
_ => panic!("Received invalid RPC message"),
},
Async::Ready(Some(_)) => (),
Async::Ready(None) | Async::NotReady => return Ok(Async::NotReady),
}
}
});
// execute the futures and check the result
let test_result = Arc::new(Mutex::new(false));
let error_result = test_result.clone();
let thread_result = test_result.clone();
tokio::run(
sender_future
.select(receiver_future)
.timeout(Duration::from_millis(1000))
.map_err(move |_| *error_result.lock().unwrap() = false)
.map(move |result| {
*thread_result.lock().unwrap() = result.0;
()
}),
);
assert!(*test_result.lock().unwrap());
} | rust_cleaned_test_functions.jsonl/57321 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2963
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25201,
3710,
9698,
30539,
291,
60799,
368,
341,
262,
442,
738,
705,
279,
8392,
13,
576,
2188,
323,
8970,
8392,
476,
537,
198,
262,
1077,
1487,
8274,
284,
9395,
486,
6550,
280,
262,
1077,
7283,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_parse_encoded_pointer_textrel() {
let encoding = constants::DW_EH_PE_textrel;
let expected_rest = [1, 2, 3, 4];
let input = Section::with_endian(Endian::Little)
.L32(0x1)
.append_bytes(&expected_rest);
let input = input.get_contents().unwrap();
let input = EndianSlice::new(&input, LittleEndian);
let mut rest = input;
let parameters = PointerEncodingParameters {
bases: &BaseAddresses::default().set_text(0x10).eh_frame,
func_base: None,
address_size: 4,
section: &input,
};
assert_eq!(
parse_encoded_pointer(encoding, ¶meters, &mut rest),
Ok(Pointer::Direct(0x11))
);
assert_eq!(rest, EndianSlice::new(&expected_rest, LittleEndian));
} | rust_cleaned_test_functions.jsonl/9405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
73069,
21425,
4326,
3748,
368,
341,
286,
1077,
11170,
284,
18021,
486,
54219,
2089,
39,
45784,
4326,
3748,
280,
286,
1077,
3601,
32231,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_str_as_json() {
let mut ctx = EvalContext::new(Arc::new(EvalConfig::default_for_test()));
let cases = vec![
(
false,
vec![Datum::Bytes(b"[1,2,3]".to_vec())],
Some(Json::String(String::from("[1,2,3]"))),
),
(
true,
vec![Datum::Bytes(b"[1,2,3]".to_vec())],
Some(Json::Array(vec![Json::I64(1), Json::I64(2), Json::I64(3)])),
),
(false, vec![Datum::Null], None),
(true, vec![Datum::Null], None),
];
for (by_parse, cols, exp) in cases {
let col_expr = col_expr(0, FieldTypeTp::String);
let mut ex = scalar_func_expr(ScalarFuncSig::CastStringAsJson, &[col_expr]);
if by_parse {
let mut flag = ex.get_field_type().flag();
flag |= FieldTypeFlag::PARSE_TO_JSON;
ex.mut_field_type().as_mut_accessor().set_flag(flag);
}
let e = Expression::build(&ctx, ex).unwrap();
let res = e.eval_json(&mut ctx, &cols).unwrap();
if exp.is_none() {
assert!(res.is_none());
continue;
}
assert_eq!(res.unwrap().into_owned(), exp.unwrap());
}
} | rust_cleaned_test_functions.jsonl/2968 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 782
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
2895,
11898,
9455,
368,
341,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
931,
4346,
1287,
486,
931,
10722,
831,
2648,
486,
2258,
5478,
4452,
7392,
286,
1077,
5048,
284,
7486,
90515,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_remove_soa() {
let name = Name::from_str("www.example.com.").unwrap();
let record_type = RecordType::SOA;
let mut rr_set = RecordSet::new(&name, record_type, 0);
let insert = Record::new()
.set_name(name.clone())
.set_ttl(3600)
.set_rr_type(RecordType::SOA)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::SOA(SOA::new(
Name::from_str("sns.dns.icann.org.").unwrap(),
Name::from_str("noc.dns.icann.org.").unwrap(),
2015082403,
7200,
3600,
1209600,
3600,
)))
.clone();
assert!(rr_set.insert(insert.clone(), 0));
assert!(!rr_set.remove(&insert, 0));
assert!(rr_set.records_without_rrsigs().any(|ref x| x == &&insert));
} | rust_cleaned_test_functions.jsonl/119981 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
643,
19533,
368,
341,
286,
1077,
829,
284,
3988,
486,
1499,
2895,
445,
2136,
7724,
905,
98401,
15454,
543,
286,
1077,
3255,
1819,
284,
13583,
929,
486,
13880,
32,
280,
286,
1077,
5206,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_division_by_zero() {
Variant::VDouble(1.0)
.divide(Variant::VSingle(0.0))
.expect_err("Division by zero");
Variant::VDouble(1.0)
.divide(Variant::VDouble(0.0))
.expect_err("Division by zero");
Variant::VDouble(1.0)
.divide(Variant::VInteger(0))
.expect_err("Division by zero");
Variant::VDouble(1.0)
.divide(Variant::VLong(0))
.expect_err("Division by zero");
} | rust_cleaned_test_functions.jsonl/84616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
1816,
3710,
19359,
368,
341,
394,
39292,
486,
53,
7378,
7,
16,
13,
15,
340,
503,
659,
59394,
12410,
15341,
486,
53,
10888,
7,
15,
13,
15,
1171,
503,
659,
17119,
9266,
445,
51237,
553,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rev_iterator() {
use iter::*;
let xs = [1, 2, 5, 10, 11];
let ys = [11, 10, 5, 2, 1];
let mut i = 0;
for &x in xs.iter().rev() {
assert_eq!(x, ys[i]);
i += 1;
}
assert_eq!(i, 5);
} | rust_cleaned_test_functions.jsonl/75626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38082,
13491,
368,
341,
286,
990,
5367,
79304,
286,
1077,
11943,
284,
508,
16,
11,
220,
17,
11,
220,
20,
11,
220,
16,
15,
11,
220,
16,
16,
935,
286,
1077,
31810,
284,
508,
16,
16,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_as_member_with_valid_args() {
let sender_id = sender_id();
let candidate_block = get_block(0);
let prev_state = Member::for_test().build();
let conman = TestConnectionManager::new();
let mut rpc = MockRpc::new();
// It should call testproposedblock RPC once.
rpc.should_call_testproposedblock(Ok(true));
let params = NodeParametersBuilder::new().rpc(rpc).build();
let next_state =
process_candidateblock(&sender_id, &candidate_block, &prev_state, &conman, ¶ms);
// It should set candidate_block into return state.
match next_state {
NodeState::Member {
candidate_block: Some(block),
..
} => assert_eq!(candidate_block, block),
_ => assert!(false),
}
let sent_messages = conman.sent.borrow();
assert_eq!(sent_messages.len(), 4);
for message_type in sent_messages.iter() {
match message_type {
Message {
message_type: MessageType::Blockvss(..),
..
} => assert!(true),
m => assert!(false, format!("Sent unexpected message {:?}", m)),
}
}
params.rpc.assert();
} | rust_cleaned_test_functions.jsonl/99673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 648
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
19388,
6615,
8337,
8384,
368,
341,
286,
1077,
4646,
842,
284,
4646,
842,
543,
286,
1077,
9144,
7113,
284,
633,
7113,
7,
15,
317,
286,
1077,
7872,
4387,
284,
12039,
486,
1958,
4452,
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... | 4 |
#[test]
fn test_verify_pin() {
let mut yubikey = YUBIKEY.lock().unwrap();
assert!(yubikey.verify_pin(b"000000").is_err());
assert!(yubikey.verify_pin(b"123456").is_ok());
} | rust_cleaned_test_functions.jsonl/33334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
26296,
368,
341,
262,
1077,
5206,
379,
54233,
792,
284,
809,
4493,
40,
4784,
21003,
1005,
15454,
543,
262,
2060,
10297,
88,
54233,
792,
27520,
26296,
1883,
1,
15,
15,
15,
15,
15,
15,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fr_display() {
assert_eq!(
format!(
"{}",
Fr::from_repr(FrRepr([
0xc7, 0xec, 0xb5, 0xa3, 0x46, 0xe7, 0xca, 0xc3, 0xee, 0x5a, 0x5b, 0x3f, 0xeb, 0xc8,
0x5e, 0x18, 0x99, 0xdd, 0xb9, 0xe4, 0xff, 0x99, 0x44, 0x68, 0xaa, 0x8f, 0xb6, 0xaf,
0xa7, 0xbb, 0xc9, 0x07,
]))
.unwrap()
),
"Fr(0x07c9bba7afb68faa684499ffe4b9dd99185ec8eb3f5b5aeec3cae746a3b5ecc7)".to_string()
);
assert_eq!(
format!(
"{}",
Fr::from_repr(FrRepr([
0x06, 0x81, 0x19, 0xff, 0x98, 0x12, 0xc7, 0x44, 0x6a, 0x9b, 0xf7, 0x7d, 0x81, 0x10,
0xad, 0xb0, 0x2b, 0x13, 0x74, 0x2b, 0x0a, 0xa8, 0x34, 0xd0, 0x19, 0x07, 0xf5, 0x36,
0x13, 0x9a, 0xcf, 0x41,
]))
.unwrap()
),
"Fr(0x41cf9a1336f50719d034a80a2b74132bb0ad10817df79b6a44c71298ff198106)".to_string()
);
} | rust_cleaned_test_functions.jsonl/100657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 703
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
14825,
368,
341,
262,
2060,
10714,
33673,
286,
3561,
33673,
310,
35503,
756,
310,
2869,
486,
1499,
68535,
7832,
81,
693,
649,
8956,
394,
220,
15,
8148,
22,
11,
220,
15,
52350,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_coded_from_sequence() {
let sample = "appl";
let coded = Keys::from_sequence(sample.chars(), std::u8::MAX).unwrap();
assert_eq!(coded.keys.len(), 3);
// Check order of symbols.
assert_eq!(coded.keys[0].0, 'p');
assert_eq!(coded.keys[1].0, 'a');
assert_eq!(coded.keys[2].0, 'l');
// Check bit length of symbols.
assert_eq!(coded.keys[0].1.bit_len, 1.into());
assert_eq!(coded.keys[1].1.bit_len, 2.into());
assert_eq!(coded.keys[2].1.bit_len, 2.into());
// Check code of symbols.
assert_eq!(coded.keys[0].1.bits, 0b00);
assert_eq!(coded.keys[1].1.bits, 0b10);
assert_eq!(coded.keys[2].1.bits, 0b11);
// Let's try again with a limit to 1 bit paths.
assert_eq!(Keys::from_sequence(sample.chars(), 1).unwrap_err(), 2);
} | rust_cleaned_test_functions.jsonl/67980 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
6737,
5673,
23735,
368,
341,
262,
1077,
6077,
284,
330,
76096,
876,
262,
1077,
46673,
284,
24133,
486,
1499,
23735,
32968,
85062,
1507,
1460,
486,
84,
23,
486,
10586,
568,
15454,
1428,
1066,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vertex() {
let value = json!({"@type":"g:Vertex", "@value":{"id":{"@type":"g:Int32","@value":45}}});
let result = deserializer_v3(&value).expect("Failed to deserialize a Vertex");
assert_eq!(
result,
Vertex::new(GID::Int32(45), String::from("vertex"), HashMap::new()).into()
);
let value = r#"{"@type":"g:Vertex","@value":{"id":{"@type":"g:Int32","@value":1},"label":"person","properties":{"name":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":0},"value":"marko","label":"name"}}],"location":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":6},"value":"san diego","label":"location","properties":{"startTime":{"@type":"g:Int32","@value":1997},"endTime":{"@type":"g:Int32","@value":2001}}}},{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":7},"value":"santa cruz","label":"location","properties":{"startTime":{"@type":"g:Int32","@value":2001},"endTime":{"@type":"g:Int32","@value":2004}}}},{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":8},"value":"brussels","label":"location","properties":{"startTime":{"@type":"g:Int32","@value":2004},"endTime":{"@type":"g:Int32","@value":2005}}}},{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":9},"value":"santa fe","label":"location","properties":{"startTime":{"@type":"g:Int32","@value":2005}}}}]}}}"#;
let val = serde_json::from_str(&value).expect("Failed to serialize");
let result = deserializer_v3(&val).expect("Failed to deserialize a vertex");
assert_eq!(
result,
vertex!({
id => 1,
label => "person",
properties => {
"name" => [ { id => 0 as i64 , value => "marko"}],
"location" => [{ id => 6 as i64, value => "san diego"},{ id => 7 as i64 , value => "santa cruz"},{ id => 8 as i64, value => "brussels"},{ id => 9 as i64, value => "santa fe"}]
}
}).into()
);
} | rust_cleaned_test_functions.jsonl/1813 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 878
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26611,
368,
341,
286,
1077,
897,
284,
2951,
0,
16864,
31,
1313,
3252,
70,
25,
8320,
497,
8428,
957,
22317,
307,
22317,
31,
1313,
3252,
70,
43979,
18,
17,
2198,
31,
957,
788,
19,
20,
3417,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_service() {
let blank = || Ok::<_, ()>(Srv);
let new_srv = blank.into_new_service().map(|_| "ok");
if let Async::Ready(mut srv) = new_srv.new_service(&()).poll().unwrap() {
let res = srv.call(()).poll();
assert!(res.is_ok());
assert_eq!(res.unwrap(), Async::Ready("ok"));
} else {
panic!()
}
} | rust_cleaned_test_functions.jsonl/94930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
12267,
368,
341,
286,
1077,
10113,
284,
1369,
7622,
27638,
6878,
1719,
2235,
50,
10553,
317,
286,
1077,
501,
63921,
284,
10113,
39860,
5921,
12267,
1005,
2186,
22428,
35395,
330,
562,
797,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_sgemv() {
let a: Rearray<f32> = Rearray::zeros(IndexNd::from(vec![17, 8]));
let x: Rearray<f32> = Rearray::zeros(IndexNd::from(vec![8]));
let mut y: Rearray<f32> = Rearray::zeros(IndexNd::from(vec![17]));
y.matrix_vector_mult(1.0, a.clone(), x.clone(), 0.0);
} | rust_cleaned_test_functions.jsonl/81440 | {
"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,
643,
34103,
85,
368,
341,
220,
1077,
264,
25,
45902,
11611,
63895,
18,
17,
29,
284,
45902,
11611,
486,
35716,
45030,
39837,
486,
1499,
25592,
20703,
16,
22,
11,
220,
23,
14382,
220,
1077,
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_and_with_multiple_not_eq_to_string() {
let name1 = _random_vector(10);
let value1 = _random_string(10);
let name2 = _random_vector(10);
let value2 = _random_string(10);
let name3 = _random_vector(10);
let value3 = _random_string(10);
let query = Operator::And(
vec![
Operator::Not(
Box::new(
Operator::Eq(
TagName::PlainTagName(name1.clone()),
TargetValue::Unencrypted(value1.clone())
)
)
),
Operator::Not(
Box::new(
Operator::Eq(
TagName::PlainTagName(name2.clone()),
TargetValue::Unencrypted(value2.clone())
)
)
),
Operator::Not(
Box::new(
Operator::Eq(
TagName::PlainTagName(name3.clone()),
TargetValue::Unencrypted(value3.clone())
)
)
),
]
);
let json = query.to_string();
let expected = format!(r#"{{"$and":[{{"$not":{{"~{}":"{}"}}}},{{"$not":{{"~{}":"{}"}}}},{{"$not":{{"~{}":"{}"}}}}]}}"#,
base64::encode(&name1), value1,
base64::encode(&name2), value2,
base64::encode(&name3), value3,
);
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1095
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8378,
6615,
45233,
7913,
10714,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
829,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_private_static_member_functions_not_present() {
let ir = ir_from_cc(
"
struct SomeStruct {
public:
static int public_method();
protected:
static int protected_method();
private:
static int private_method();
};
",
)
.unwrap();
assert_ir_matches!(ir, quote! { Func { name: "public_method" ... } });
assert_ir_not_matches!(ir, quote! { Func { name: "protected_method" ... } });
assert_ir_not_matches!(ir, quote! { Func { name: "private_method" ... } });
} | rust_cleaned_test_functions.jsonl/37163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
26249,
25360,
19388,
31708,
7913,
36976,
368,
341,
262,
1077,
6216,
284,
6216,
5673,
28955,
1006,
286,
6228,
286,
2036,
4329,
9422,
341,
688,
584,
510,
310,
1099,
526,
584,
9032,
543,
688,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drive_2() {
let input = String::from("[usagi,[pyon, poin], b]");
let mut output = String::new();
let expected =
r#"<'[',LBrack>
<'usagi',Name>
<',',Comma>
<'[',LBrack>
<'pyon',Name>
<',',Comma>
<'poin',Name>
<']',RBrack>
<',',Comma>
<'b',Name>
<']',RBrack>
<'<EOF>',<EOF>>"#;
output = drive(input, output);
assert_eq!(expected, output.as_str());
} | rust_cleaned_test_functions.jsonl/131309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67151,
62,
17,
368,
341,
262,
1077,
1946,
284,
923,
486,
1499,
10937,
355,
36035,
17259,
3288,
263,
11,
220,
281,
1961,
1125,
293,
37389,
262,
1077,
5206,
2550,
284,
923,
486,
931,
543,
262,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_syntaxes() {
use super::syntax;
error_case!(
syntax,
&vec![],
Error::IdentifierExpected.spanning(Span::from(((0, 0), (0, 0))))
);
ok_case!(
syntax,
&vec![
Token::Nonterminal("a".to_owned()).spanning(Span::from(((0, 0), (1, 0)))),
Token::Definition.spanning(Span::from(((2, 0), (3, 0)))),
Token::Terminal("d".to_owned()).spanning(Span::from(((4, 0), (6, 0)))),
Token::DefinitionSeparator.spanning(Span::from(((8, 0), (9, 0)))),
Token::StartRepeat.spanning(Span::from(((10, 0), (11, 0)))),
Token::Integer(2).spanning(Span::from(((11, 0), (12, 0)))),
Token::Repetition.spanning(Span::from(((13, 0), (14, 0)))),
Token::Terminal("e".to_owned()).spanning(Span::from(((15, 0), (18, 0)))),
Token::EndRepeat.spanning(Span::from(((18, 0), (19, 0)))),
Token::Terminator.spanning(Span::from(((19, 0), (20, 0)))),
Token::Nonterminal("b".to_owned()).spanning(Span::from(((33, 0), (34, 0)))),
Token::Definition.spanning(Span::from(((35, 0), (36, 0)))),
Token::Terminal("a".to_owned()).spanning(Span::from(((37, 0), (40, 0)))),
Token::Concatenation.spanning(Span::from(((40, 0), (41, 0)))),
Token::StartGroup.spanning(Span::from(((42, 0), (43, 0)))),
Token::Nonterminal("a".to_owned()).spanning(Span::from(((43, 0), (44, 0)))),
Token::DefinitionSeparator.spanning(Span::from(((45, 0), (46, 0)))),
Token::Terminal("c".to_owned()).spanning(Span::from(((47, 0), (50, 0)))),
Token::EndGroup.spanning(Span::from(((50, 0), (51, 0)))),
Token::Terminator.spanning(Span::from(((51, 0), (52, 0)))),
],
20,
Grammar {
productions: vec![
Production {
lhs: "a".to_owned().spanning(Span::from(((0, 0), (1, 0)))),
rhs: Expression::Alternative {
first: Box::new(
Expression::Terminal("d".to_owned())
.spanning(Span::from(((4, 0), (6, 0))))
),
second: Box::new(
Expression::Repeated(Box::new(
Expression::Factor {
count: 2.spanning(Span::from(((11, 0), (12, 0)))),
primary: Box::new(
Expression::Terminal("e".to_owned())
.spanning(Span::from(((15, 0), (18, 0))))
)
}
.spanning(Span::from(((11, 0), (18, 0))))
))
.spanning(Span::from(((10, 0), (19, 0))))
),
rest: Vec::new(),
}
.spanning(Span::from(((4, 0), (19, 0))))
}
.spanning(Span::from(((0, 0), (20, 0)))),
Production {
lhs: "b".to_owned().spanning(Span::from(((33, 0), (34, 0)))),
rhs: Expression::Sequence {
first: Box::new(
Expression::Terminal("a".to_owned())
.spanning(Span::from(((37, 0), (40, 0))))
),
second: Box::new(
Expression::Alternative {
first: Box::new(
Expression::Nonterminal("a".to_owned())
.spanning(Span::from(((43, 0), (44, 0))))
),
second: Box::new(
Expression::Terminal("c".to_owned())
.spanning(Span::from(((47, 0), (50, 0))))
),
rest: Vec::new(),
}
.spanning(Span::from(((42, 0), (51, 0))))
),
rest: Vec::new(),
}
.spanning(Span::from(((37, 0), (51, 0))))
}
.spanning(Span::from(((33, 0), (52, 0))))
]
}
.spanning(Span::from(((0, 0), (52, 0))))
);
} | rust_cleaned_test_functions.jsonl/101089 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2870
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78894,
288,
368,
341,
262,
990,
2256,
486,
56193,
401,
262,
1465,
19096,
33673,
286,
19482,
345,
286,
609,
4083,
20703,
1259,
286,
4600,
486,
8714,
18896,
52869,
1229,
3759,
848,
486,
1499,
6636,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sync() {
use std::sync::{
atomic::{AtomicI32, AtomicU64, Ordering},
Arc,
};
use std::thread;
trait AtomicInt: Send + Sync {
fn increment(&self);
fn get(&self) -> u64;
}
impl AtomicInt for AtomicI32 {
fn increment(&self) {
self.fetch_add(1, Ordering::Relaxed);
}
fn get(&self) -> u64 {
self.load(Ordering::Relaxed) as u64
}
}
impl AtomicInt for AtomicU64 {
fn increment(&self) {
self.fetch_add(1, Ordering::Relaxed);
}
fn get(&self) -> u64 {
self.load(Ordering::Relaxed)
}
}
// Create a stack with different type of atomic integers in it.
// is likely to interleave.
let mut stack: DynStack<dyn AtomicInt> = DynStack::new();
for i in 0..10_000 {
if i % 2 == 0 {
dyn_push!(stack, AtomicI32::new(0));
} else {
dyn_push!(stack, AtomicU64::new(0));
}
}
let stack = Arc::new(stack);
// Loop over the stack and increment every value once in each thread
let mut threads = Vec::new();
for _ in 0..100 {
let stack = stack.clone();
threads.push(thread::spawn(move || {
for int in stack.iter() {
int.increment();
}
}));
}
for thread in threads {
thread.join().expect("Joining threads");
}
for int in stack.iter() {
assert_eq!(int.get(), 100);
}
} | rust_cleaned_test_functions.jsonl/21302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 747
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23008,
368,
341,
262,
990,
1460,
486,
12996,
74843,
286,
24510,
22964,
65857,
40,
18,
17,
11,
30316,
52,
21,
19,
11,
68621,
1583,
286,
19689,
345,
262,
2605,
262,
990,
1460,
486,
4528,
401,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cidr() {
let cidr = Cidr::new(Address::new(192, 168, 1, 10), 24);
let inside_subnet = [
[192, 168, 1, 0], [192, 168, 1, 1],
[192, 168, 1, 2], [192, 168, 1, 10],
[192, 168, 1, 127], [192, 168, 1, 255],
];
let outside_subnet = [
[192, 168, 0, 0], [127, 0, 0, 1],
[192, 168, 2, 0], [192, 168, 0, 255],
[ 0, 0, 0, 0], [255, 255, 255, 255],
];
let subnets = [
([192, 168, 1, 0], 32),
([192, 168, 1, 255], 24),
([192, 168, 1, 10], 30),
];
let not_subnets = [
([192, 168, 1, 10], 23),
([127, 0, 0, 1], 8),
([192, 168, 1, 0], 0),
([192, 168, 0, 255], 32),
];
for addr in inside_subnet.iter().map(|a| Address::from_bytes(a)) {
assert!(cidr.contains_addr(&addr));
}
for addr in outside_subnet.iter().map(|a| Address::from_bytes(a)) {
assert!(!cidr.contains_addr(&addr));
}
for subnet in subnets.iter().map(
|&(a, p)| Cidr::new(Address::new(a[0], a[1], a[2], a[3]), p)) {
assert!(cidr.contains_subnet(&subnet));
}
for subnet in not_subnets.iter().map(
|&(a, p)| Cidr::new(Address::new(a[0], a[1], a[2], a[3]), p)) {
assert!(!cidr.contains_subnet(&subnet));
}
let cidr_without_prefix = Cidr::new(cidr.address(), 0);
assert!(cidr_without_prefix.contains_addr(&Address::new(127, 0, 0, 1)));
} | rust_cleaned_test_functions.jsonl/82367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 974
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68699,
81,
368,
341,
286,
1077,
32141,
81,
284,
356,
307,
81,
486,
931,
68492,
486,
931,
7,
16,
24,
17,
11,
220,
16,
21,
23,
11,
220,
16,
11,
220,
16,
15,
701,
220,
17,
19,
626,
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... | 5 |
#[test]
fn test_has_path_1() {
let maze = vec![
vec![0,0,1,0,0],
vec![0,0,0,0,0],
vec![0,0,0,1,0],
vec![1,1,0,1,1],
vec![0,0,0,0,0]
];
assert_eq!(Solution::shortest_distance(maze, vec![0, 4], vec![4, 4]), 12);
} | rust_cleaned_test_functions.jsonl/131056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21778,
2638,
62,
16,
368,
341,
286,
1077,
35096,
284,
7486,
90515,
310,
7486,
20703,
15,
11,
15,
11,
16,
11,
15,
11,
15,
1259,
310,
7486,
20703,
15,
11,
15,
11,
15,
11,
15,
11,
15,
1259,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insertion_block_and_position_at_end() {
let modl = Module::new("test");
let f = modl.add_function("testf", FunctionType::new(Type::int32(), &vec![], false));
let entry_b = f.append_bb("entry");
let builder = IRBuilder::new();
builder.position_at_end(f.entry_bb().unwrap());
assert_eq!(builder.insertion_block().unwrap(), entry_b);
} | rust_cleaned_test_functions.jsonl/126188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
290,
7113,
8378,
9661,
3752,
6213,
368,
341,
286,
1077,
1463,
75,
284,
13711,
486,
931,
445,
1944,
797,
286,
1077,
282,
284,
1463,
75,
1364,
9174,
445,
1944,
69,
497,
5712,
929,
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... | 1 |
#[test]
fn test_bank_update_sysvar_account() {
use sysvar::clock::Clock;
let dummy_clock_id = solana_sdk::pubkey::new_rand();
let dummy_rent_epoch = 44;
let (mut genesis_config, _mint_keypair) = create_genesis_config(500);
let expected_previous_slot = 3;
let mut expected_next_slot = expected_previous_slot + 1;
activate_all_features(&mut genesis_config);
let bank1 = Arc::new(Bank::new(&genesis_config));
assert_eq!(bank1.calculate_capitalization(true), bank1.capitalization());
assert_capitalization_diff(
&bank1,
|| {
bank1.update_sysvar_account(&dummy_clock_id, |optional_account| {
assert!(optional_account.is_none());
let mut account = create_account(
&Clock {
slot: expected_previous_slot,
..Clock::default()
},
bank1.inherit_specially_retained_account_fields(optional_account),
);
account.set_rent_epoch(dummy_rent_epoch);
account
});
let current_account = bank1.get_account(&dummy_clock_id).unwrap();
assert_eq!(
expected_previous_slot,
from_account::<Clock, _>(¤t_account).unwrap().slot
);
assert_eq!(dummy_rent_epoch, current_account.rent_epoch());
},
|old, new| {
assert_eq!(
old + min_rent_excempt_balance_for_sysvars(&bank1, &[sysvar::clock::id()]),
new
);
},
);
assert_capitalization_diff(
&bank1,
|| {
bank1.update_sysvar_account(&dummy_clock_id, |optional_account| {
assert!(optional_account.is_some());
create_account(
&Clock {
slot: expected_previous_slot,
..Clock::default()
},
bank1.inherit_specially_retained_account_fields(optional_account),
)
})
},
|old, new| {
// creating new sysvar twice in a slot shouldn't increment capitalization twice
assert_eq!(old, new);
},
);
// Updating should increment the clock's slot
let bank2 = Arc::new(Bank::new_from_parent(&bank1, &Pubkey::default(), 1));
assert_capitalization_diff(
&bank2,
|| {
bank2.update_sysvar_account(&dummy_clock_id, |optional_account| {
let slot = from_account::<Clock, _>(optional_account.as_ref().unwrap())
.unwrap()
.slot
+ 1;
create_account(
&Clock {
slot,
..Clock::default()
},
bank2.inherit_specially_retained_account_fields(optional_account),
)
});
let current_account = bank2.get_account(&dummy_clock_id).unwrap();
assert_eq!(
expected_next_slot,
from_account::<Clock, _>(¤t_account).unwrap().slot
);
// with rent_for_sysvars
assert_eq!(dummy_rent_epoch, current_account.rent_epoch());
},
|old, new| {
assert_eq!(old, new);
},
);
// Updating again should give bank2's sysvar to the closure not bank1's.
expected_next_slot += 1;
assert_capitalization_diff(
&bank2,
|| {
bank2.update_sysvar_account(&dummy_clock_id, |optional_account| {
let slot = from_account::<Clock, _>(optional_account.as_ref().unwrap())
.unwrap()
.slot
+ 1;
create_account(
&Clock {
slot,
..Clock::default()
},
bank2.inherit_specially_retained_account_fields(optional_account),
)
});
let current_account = bank2.get_account(&dummy_clock_id).unwrap();
assert_eq!(
expected_next_slot,
from_account::<Clock, _>(¤t_account).unwrap().slot
);
},
|old, new| {
// updating twice in a slot shouldn't increment capitalization twice
assert_eq!(old, new);
},
);
} | rust_cleaned_test_functions.jsonl/2593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2976
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
8882,
20344,
947,
13500,
368,
341,
286,
990,
5708,
947,
486,
20666,
486,
26104,
401,
286,
1077,
17292,
23062,
842,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
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... | 5 |
#[test]
fn test_git_diff_U0_is_unchanged_under_color_only() {
let config = integration_test_utils::make_config_from_args(&["--color-only"]);
let input = DIFF_WITH_TWO_ADDED_LINES_CREATED_BY_GIT_DIFF_U0;
let output = integration_test_utils::run_delta(input, &config);
let output = strip_ansi_codes(&output);
assert_eq!(output, input);
} | rust_cleaned_test_functions.jsonl/70112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68801,
15850,
6665,
15,
6892,
62,
3185,
3726,
58228,
6714,
18410,
368,
341,
286,
1077,
2193,
284,
17590,
4452,
17309,
486,
6927,
5332,
5673,
8384,
2099,
1183,
313,
3423,
15382,
15049,
286,
1077,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mars_move_rover_left() {
let mut m = Mars::new(Coordinate::new(5, 5));
let r = Rover::new(Coordinate::new(3, 3), Orientation::N);
let actual = m.move_rover(r, Instructions::L).unwrap();
assert_eq!(actual, Rover::new(Coordinate::new(3, 3), Orientation::W));
} | rust_cleaned_test_functions.jsonl/107062 | {
"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,
717,
1561,
17134,
26608,
423,
9579,
368,
341,
286,
1077,
5206,
296,
284,
21048,
486,
931,
3025,
78,
8730,
486,
931,
7,
20,
11,
220,
20,
1106,
286,
1077,
435,
284,
52176,
486,
931,
3025,
78,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_stopwords() {
let all_words = STOP_WORDS
.iter()
.map(|&word| word.to_string())
.collect::<Vec<_>>()
.join(" ");
let removed = remove_stop_words(&all_words).replace(' ', "");
// the remaining chars are from the contraction-based stop words
assert_eq!(removed, "'d'll'm''s'ven'tn‘tn’t‘d‘ll‘m‘‘s‘ve’d’ll’m’’s’ve");
} | rust_cleaned_test_functions.jsonl/43624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
19039,
5761,
368,
341,
286,
1077,
678,
18981,
284,
45537,
88421,
198,
310,
659,
2015,
741,
310,
659,
2186,
22428,
5,
1158,
91,
3409,
2389,
3904,
2398,
310,
659,
17384,
27638,
10050,
32399,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tab() {
let idtab = AtomTable::new();
let id_foo = idtab.atom("foo");
let p_foo: *const str = idtab.str(id_foo);
let id_bar = idtab.atom("bar");
assert_ne!(id_foo, id_bar);
assert_eq!(idtab.atom("foo"), id_foo);
assert_eq!(idtab.atom("bar"), id_bar);
assert_eq!(idtab.atom(String::from("foo")), id_foo);
assert_eq!(idtab.atom(String::from("bar")), id_bar);
assert_eq!(idtab.str(id_foo), "foo");
assert_eq!(idtab.str(id_bar), "bar");
assert_eq!(idtab.str(id_foo) as *const str, p_foo);
} | rust_cleaned_test_functions.jsonl/72313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17344,
368,
341,
286,
1077,
877,
6192,
284,
39516,
2556,
486,
931,
1428,
286,
1077,
877,
761,
2624,
284,
877,
6192,
80759,
445,
7975,
797,
286,
1077,
281,
761,
2624,
25,
353,
1024,
607,
284,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_1pc_check_max_commit_ts() {
let engine = crate::storage::TestEngineBuilder::new().build().unwrap();
let cm = ConcurrencyManager::new(42.into());
let snapshot = engine.snapshot(Default::default()).unwrap();
let mut txn = MvccTxn::new(snapshot, 10.into(), false, cm.clone());
prewrite(
&mut txn,
Mutation::Put((Key::from_raw(b"k1"), b"v1".to_vec())),
b"k1",
&None,
false,
2000,
2,
10.into(),
50.into(),
true,
)
.unwrap();
cm.update_max_ts(60.into());
// prewrite(
&mut txn,
Mutation::Put((Key::from_raw(b"k2"), b"v2".to_vec())),
b"k1",
&None,
false,
2000,
1,
10.into(),
50.into(),
true,
)
.unwrap_err();
} | rust_cleaned_test_functions.jsonl/78264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 586
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
3992,
7200,
6345,
36346,
25023,
368,
341,
286,
1077,
4712,
284,
17717,
486,
16172,
486,
2271,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
9961,
284,
1200,
15973,
2043,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vhost_user_net() {
test_block!(tb, "", {
let mut clear = ClearDiskConfig::new();
let guest = Guest::new(&mut clear);
let mut workload_path = dirs::home_dir().unwrap();
workload_path.push("workloads");
let mut vubridge_path = workload_path.clone();
vubridge_path.push("vubridge");
let vubridge_path = String::from(vubridge_path.to_str().unwrap());
// Start the daemon
let mut daemon_child = Command::new(vubridge_path.as_str()).spawn().unwrap();
let mut cloud_child = Command::new("target/debug/cloud-hypervisor")
.args(&["--cpus", "4"])
.args(&["--memory", "size=512M,file=/dev/shm"])
.args(&["--kernel", guest.fw_path.as_str()])
.args(&[
"--disk",
guest
.disk_config
.disk(DiskType::OperatingSystem)
.unwrap()
.as_str(),
guest
.disk_config
.disk(DiskType::CloudInit)
.unwrap()
.as_str(),
])
.args(&[
"--vhost-user-net",
"mac=52:54:00:02:d9:01,sock=/tmp/vubr.sock",
])
.args(&["--net", guest.default_net_string().as_str()])
.spawn()
.unwrap();
// 2 network interfaces + default localhost ==> 3 interfaces
aver_eq!(
tb,
guest
.ssh_command("ip -o link | wc -l")
.unwrap_or_default()
.trim()
.parse::<u32>()
.unwrap_or_default(),
3
);
thread::sleep(std::time::Duration::new(5, 0));
let _ = daemon_child.kill();
let _ = daemon_child.wait();
guest.ssh_command("sudo reboot")?;
thread::sleep(std::time::Duration::new(5, 0));
let _ = cloud_child.kill();
let _ = cloud_child.wait();
Ok(())
});
} | rust_cleaned_test_functions.jsonl/55943 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
3790,
3317,
19722,
368,
341,
286,
1273,
7113,
10297,
18387,
11,
7342,
341,
310,
1077,
5206,
2797,
284,
12023,
47583,
2648,
486,
931,
543,
310,
1077,
8640,
284,
26215,
486,
931,
2099,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.