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_curve_point_addition() -> Result<(), PlonkError> {
test_curve_point_addition_helper::<FqEd354, Param254>()?;
test_curve_point_addition_helper::<FqEd377, Param377>()?;
test_curve_point_addition_helper::<FqEd381, Param381>()?;
test_curve_point_addition_helper::<FqEd381b, Param381b>()?;
test_curve_point_addition_helper::<Fq377, Param761>()
} | rust_cleaned_test_functions.jsonl/33780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43407,
6085,
2891,
680,
368,
1464,
5714,
68843,
1818,
263,
74,
1454,
29,
341,
286,
1273,
43407,
6085,
2891,
680,
10418,
27638,
37,
80,
2715,
18,
20,
19,
11,
6991,
17,
20,
19,
13555,
37445,
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... | 5 |
#[test]
fn test_partial_token() {
use Token::*;
let (tokens, maybe_error) = tokenize_string("add fro");
assert_eq!(tokens, vec![Add]);
assert_eq!(maybe_error.unwrap().kind(), ErrorKind::InvalidData);
} | rust_cleaned_test_functions.jsonl/78240 | {
"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,
52068,
6458,
368,
341,
286,
990,
9660,
56162,
286,
1077,
320,
30566,
11,
7196,
4096,
8,
284,
77651,
3904,
445,
718,
12799,
797,
286,
2060,
10714,
10297,
30566,
11,
7486,
20703,
2212,
2558,
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_recvmsg_timestampns() {
use nix::sys::socket::*;
use nix::sys::uio::IoVec;
use nix::sys::time::*;
use std::time::*;
// Set up
let message = "Ohayō!".as_bytes();
let in_socket = socket(
AddressFamily::Inet,
SockType::Datagram,
SockFlag::empty(),
None).unwrap();
setsockopt(in_socket, sockopt::ReceiveTimestampns, &true).unwrap();
let localhost = InetAddr::new(IpAddr::new_v4(127, 0, 0, 1), 0);
bind(in_socket, &SockAddr::new_inet(localhost)).unwrap();
let address = getsockname(in_socket).unwrap();
// Get initial time
let time0 = SystemTime::now();
// Send the message
let iov = [IoVec::from_slice(message)];
let flags = MsgFlags::empty();
let l = sendmsg(in_socket, &iov, &[], flags, Some(&address)).unwrap();
assert_eq!(message.len(), l);
// Receive the message
let mut buffer = vec![0u8; message.len()];
let mut cmsgspace = nix::cmsg_space!(TimeSpec);
let iov = [IoVec::from_mut_slice(&mut buffer)];
let r = recvmsg(in_socket, &iov, Some(&mut cmsgspace), flags).unwrap();
let rtime = match r.cmsgs().next() {
Some(ControlMessageOwned::ScmTimestampns(rtime)) => rtime,
Some(_) => panic!("Unexpected control message"),
None => panic!("No control message")
};
// Check the final time
let time1 = SystemTime::now();
// the packet's received timestamp should lie in-between the two system
/ let rduration = Duration::new(rtime.tv_sec() as u64,
rtime.tv_nsec() as u32);
assert!(time0.duration_since(UNIX_EPOCH).unwrap() <= rduration);
assert!(rduration <= time1.duration_since(UNIX_EPOCH).unwrap());
// Close socket
nix::unistd::close(in_socket).unwrap();
} | rust_cleaned_test_functions.jsonl/134666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36118,
3236,
23073,
4412,
368,
341,
262,
990,
308,
941,
486,
7791,
486,
9556,
56162,
262,
990,
308,
941,
486,
7791,
486,
84,
815,
486,
42799,
10050,
280,
262,
990,
308,
941,
486,
7791,
486,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_hpx_uniq() {
for depth in 0..8 {
for idx in 0..Hpx::<u64>::n_cells(depth) {
assert_eq!((depth, idx), Hpx::<u64>::from_uniq_hpx(Hpx::<u64>::uniq_hpx(depth, idx)));
}
}
// Independent of T
assert_eq!(Hpx::<u64>::DIM, 2);
assert_eq!(Hpx::<u64>::N_D0_CELLS, 12);
assert_eq!(Hpx::<u64>::N_D0_BITS, 4);
assert_eq!(Hpx::<u64>::LEVEL_MASK, 3);
assert_eq!(Hpx::<u64>::shift(1), 2);
assert_eq!(Hpx::<u64>::shift(10), 20);
// Depends on T
assert_eq!(Hpx::<u64>::MAX_DEPTH, 29);
assert_eq!(Hpx::<u64>::MAX_SHIFT, 58);
assert_eq!(Hpx::<u64>::n_cells_max(), 12 * 4_u64.pow(29));
} | rust_cleaned_test_functions.jsonl/121622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
1767,
4907,
23740,
368,
341,
981,
369,
7990,
304,
220,
15,
496,
23,
341,
1843,
369,
7187,
304,
220,
15,
496,
39,
1767,
27638,
84,
21,
19,
6831,
77,
37796,
53675,
8,
341,
394,
2060,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_cmp() {
// | ETag 1 | ETag 2 | Strong Comparison | Weak Comparison |
// | `W/"1"` | `W/"1"` | no match | match |
// | `W/"1"` | `W/"2"` | no match | no match |
// | `W/"1"` | `"1"` | no match | match |
// | `"1"` | `"1"` | match | match |
let mut etag1 = EntityTag::weak("1".to_owned());
let mut etag2 = EntityTag::weak("1".to_owned());
assert!(!etag1.strong_eq(&etag2));
assert!(etag1.weak_eq(&etag2));
assert!(etag1.strong_ne(&etag2));
assert!(!etag1.weak_ne(&etag2));
etag1 = EntityTag::weak("1".to_owned());
etag2 = EntityTag::weak("2".to_owned());
assert!(!etag1.strong_eq(&etag2));
assert!(!etag1.weak_eq(&etag2));
assert!(etag1.strong_ne(&etag2));
assert!(etag1.weak_ne(&etag2));
etag1 = EntityTag::weak("1".to_owned());
etag2 = EntityTag::strong("1".to_owned());
assert!(!etag1.strong_eq(&etag2));
assert!(etag1.weak_eq(&etag2));
assert!(etag1.strong_ne(&etag2));
assert!(!etag1.weak_ne(&etag2));
etag1 = EntityTag::strong("1".to_owned());
etag2 = EntityTag::strong("1".to_owned());
assert!(etag1.strong_eq(&etag2));
assert!(etag1.weak_eq(&etag2));
assert!(!etag1.strong_ne(&etag2));
assert!(!etag1.weak_ne(&etag2));
} | rust_cleaned_test_functions.jsonl/21998 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 816
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35193,
368,
341,
286,
442,
760,
468,
5668,
220,
16,
220,
760,
468,
5668,
220,
17,
220,
760,
26099,
42451,
760,
41164,
42451,
9248,
1789,
286,
442,
760,
1565,
54,
11225,
16,
39917,
760,
1565,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dict_destructuring() -> TestResult {
let p = polar();
p.load_str(
r#"
foo(x, _: {x});
goo(x, y) if y matches {x};
moo(x, {x});
roo(a, {a, b: a});
too(a, _: {a, b: a});
"#,
)?;
for s in &["foo", "goo"] {
qeval(&p, &format!("{}(1, {{x: 1}})", s));
qnull(&p, &format!("{}(2, {{x: 1}})", s));
qnull(&p, &format!("{}(1, {{x: 2}})", s));
qeval(&p, &format!("{}(2, {{x: 2, y: 3}})", s));
}
qeval(&p, "moo(1, {x: 1})");
qnull(&p, "moo(2, {x: 1})");
qnull(&p, "moo(1, {x: 2})");
qnull(&p, "moo(2, {x: 2, y: 3})");
qeval(&p, "roo(1, {a: 1, b: 1})");
qeval(&p, "too(1, {a: 1, b: 1})");
qnull(&p, "roo(1, {a: 1, b: 1, c: 2})");
qeval(&p, "too(1, {a: 1, b: 1, c: 2})");
Ok(())
} | rust_cleaned_test_functions.jsonl/68137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 505
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5243,
2259,
62172,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
543,
262,
281,
5104,
2895,
1006,
286,
435,
2,
698,
286,
15229,
2075,
11,
58536,
314,
87,
2960,
286,
79466,
2075,
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... | 3 |
#[test]
fn test_gc_bypass_raft() {
let (cluster, leader, ctx) = must_new_cluster_mul(1);
cluster.pd_client.disable_default_operator();
let env = Arc::new(Environment::new(1));
let leader_store = leader.get_store_id();
let channel = ChannelBuilder::new(env).connect(&cluster.sim.rl().get_addr(leader_store));
let client = TikvClient::new(channel);
let pk = b"k1".to_vec();
let value = vec![b'x'; 300];
let engine = cluster.engines.get(&leader_store).unwrap();
for &start_ts in &[10, 20, 30, 40] {
let commit_ts = start_ts + 5;
let muts = vec![new_mutation(Op::Put, b"k1", &value)];
must_kv_prewrite(&client, ctx.clone(), muts, pk.clone(), start_ts);
let keys = vec![pk.clone()];
must_kv_commit(&client, ctx.clone(), keys, start_ts, commit_ts, commit_ts);
let key = Key::from_raw(b"k1").append_ts(start_ts.into());
let key = data_key(key.as_encoded());
assert!(engine.kv.get_value(&key).unwrap().is_some());
let key = Key::from_raw(b"k1").append_ts(commit_ts.into());
let key = data_key(key.as_encoded());
assert!(engine.kv.get_value_cf(CF_WRITE, &key).unwrap().is_some());
}
let gc_sched = cluster.sim.rl().get_gc_worker(1).scheduler();
assert!(sync_gc(&gc_sched, 0, b"k1".to_vec(), b"k2".to_vec(), 200.into()).is_ok());
for &start_ts in &[10, 20, 30] {
let commit_ts = start_ts + 5;
let key = Key::from_raw(b"k1").append_ts(start_ts.into());
let key = data_key(key.as_encoded());
assert!(engine.kv.get_value(&key).unwrap().is_none());
let key = Key::from_raw(b"k1").append_ts(commit_ts.into());
let key = data_key(key.as_encoded());
assert!(engine.kv.get_value_cf(CF_WRITE, &key).unwrap().is_none());
}
} | rust_cleaned_test_functions.jsonl/36406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 836
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49423,
880,
49911,
62,
2944,
368,
341,
262,
1077,
320,
18855,
11,
7653,
11,
5635,
8,
284,
1969,
5921,
28441,
24944,
7,
16,
317,
262,
10652,
556,
67,
8179,
42628,
9993,
40594,
1428,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_iterate_with_large_range() {
assert!(ic_test_utilities::with_timeout(
std::time::Duration::new(12, 0),
|| {
let mut pool = InMemoryPoolSection::new(ic_logger::replica_logger::no_op_logger());
let min = Height::from(1);
let max = Height::from(std::u64::MAX);
pool.insert(make_artifact(fake_random_beacon(min)));
pool.insert(make_artifact(fake_random_beacon(max)));
let result = pool
.random_beacon()
.get_by_height_range(pool.random_beacon().height_range().unwrap());
assert_eq!(result.count(), 2);
}
));
} | rust_cleaned_test_functions.jsonl/28511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
6615,
45228,
9698,
368,
341,
286,
2060,
10297,
292,
4452,
94044,
486,
4197,
20537,
1006,
310,
1460,
486,
1678,
486,
12945,
486,
931,
7,
16,
17,
11,
220,
15,
1326,
310,
1369,
341,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_lexer() {
let lexer = Lexer::new("1 + 2 * 3 - -10");
assert_eq!(
lexer.lex(),
Ok(vec![
Token::number(1, Loc(0, 1)),
Token::plus(Loc(2, 3)),
Token::number(2, Loc(4, 5)),
Token::asterisk(Loc(6, 7)),
Token::number(3, Loc(8, 9)),
Token::minus(Loc(10, 11)),
Token::minus(Loc(12, 13)),
Token::number(10, Loc(13, 15)),
])
)
} | rust_cleaned_test_functions.jsonl/21939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
38815,
368,
341,
262,
1077,
53259,
284,
85082,
486,
931,
445,
16,
488,
220,
17,
353,
220,
18,
481,
481,
16,
15,
797,
262,
2060,
10714,
33673,
286,
53259,
82248,
3148,
286,
7622,
25592,
905... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_opts() {
let mut p = ::Ping::new();
assert!(p.set_timeout(5.0).is_ok());
assert!(p.set_ttl(42).is_ok());
assert!(p.set_addr_family(::AddrFamily::IPV4).is_ok());
assert!(p.set_qos(42).is_ok());
} | rust_cleaned_test_functions.jsonl/83917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
32354,
368,
341,
286,
1077,
5206,
281,
284,
3504,
69883,
486,
931,
543,
286,
2060,
10297,
79,
980,
20537,
7,
20,
13,
15,
568,
285,
19817,
1423,
286,
2060,
10297,
79,
980,
87157,
7,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pool_configs() -> Result<()> {
let (_l, hdl, pool1) = init_exclusive()?;
let pool2 = TestPool::new()?;
let root_fs = hdl
.root_filesystems()?
.collect::<zfs_rs::Result<Vec<_>>>()?;
let mut root_paths = root_fs.iter().map(|x| x.path()).collect::<Vec<_>>();
let mut expected_paths = vec![pool1.name(), pool2.name()];
root_paths.sort();
expected_paths.sort();
assert_eq!(root_paths, expected_paths);
Ok(())
} | rust_cleaned_test_functions.jsonl/102460 | {
"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,
15709,
59150,
368,
1464,
5714,
71698,
341,
262,
1077,
5453,
75,
11,
305,
8736,
11,
7314,
16,
8,
284,
2930,
2702,
8336,
94136,
262,
1077,
7314,
17,
284,
3393,
10551,
486,
931,
94136,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_intersects() {
let b1 = Box3D::from_points(&[point3(-15.0, -20.0, -20.0), point3(10.0, 20.0, 20.0)]);
let b2 = Box3D::from_points(&[point3(-10.0, 20.0, 20.0), point3(15.0, -20.0, -20.0)]);
assert!(b1.intersects(&b2));
} | rust_cleaned_test_functions.jsonl/7487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15318,
54429,
368,
341,
286,
1077,
293,
16,
284,
8261,
18,
35,
486,
1499,
12928,
2099,
58,
2768,
18,
4080,
16,
20,
13,
15,
11,
481,
17,
15,
13,
15,
11,
481,
17,
15,
13,
15,
701,
1459,
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_paren_grammar() {
let g = examples::make_paren();
let nullables = calculate_nullables(&g).unwrap();
assert!(nullables
.get_nullable_info(&NonTerminal::new("expr_list"))
.is_some());
assert!(nullables
.get_nullable_info(&NonTerminal::new("expr"))
.is_none());
assert!(nullables
.get_nullable_info(&NonTerminal::new("start"))
.is_none());
} | rust_cleaned_test_functions.jsonl/27892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
9151,
62,
41094,
368,
341,
262,
1077,
342,
284,
10295,
486,
6927,
620,
9151,
543,
262,
1077,
845,
4788,
284,
11047,
15162,
4788,
2099,
70,
568,
15454,
543,
262,
2060,
10297,
2921,
4788,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_router_advertisement_as_non_router_panic() {
// Attempting to send a router advertisement when a device is not a
// router should result in a panic.
let mut stack_builder = StackStateBuilder::default();
let mut ndp_configs = NdpConfigurations::default();
ndp_configs.set_dup_addr_detect_transmits(None);
ndp_configs.set_max_router_solicitations(None);
stack_builder.device_builder().set_default_ndp_configs(ndp_configs);
stack_builder.ipv6_builder().forward(true);
let mut ctx = Context::new(stack_builder.build(), DummyEventDispatcher::default());
let device =
ctx.state_mut().add_ethernet_device(TEST_LOCAL_MAC, Ipv6::MINIMUM_LINK_MTU.into());
crate::device::initialize_device(&mut ctx, device);
// though.
StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with(
&mut ctx,
device.id().into(),
)
.configs
.router_configurations
.set_should_send_advertisements(true);
// Should panic since `device` is not a router.
send_router_advertisement::<EthernetLinkDevice, _>(
&mut ctx,
device.id().into(),
Ipv6::ALL_NODES_LINK_LOCAL_MULTICAST_ADDRESS.into_specified(),
);
} | rust_cleaned_test_functions.jsonl/82813 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 639
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
55587,
10027,
44424,
11898,
21637,
55587,
620,
31270,
368,
341,
1789,
286,
442,
43517,
287,
311,
3624,
264,
9273,
32689,
979,
264,
3671,
374,
537,
264,
198,
286,
442,
9273,
1265,
1102,
304,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_message_picking_round_robin_on_one_queue() {
let this = canister_test_id(13);
let other = canister_test_id(14);
let mut queues = CanisterQueues::default();
assert!(queues.pop_input().is_none());
let list = vec![(0, other), (1, other), (2, other)];
for (ix, id) in list.iter() {
queues
.push_input(
QueueIndex::from(*ix),
RequestBuilder::default()
.sender(*id)
.receiver(this)
.build()
.into(),
InputQueueType::RemoteSubnet,
)
.expect("could not push");
}
for _ in 0..list.len() {
match queues.pop_input().expect("could not pop a message") {
CanisterInputMessage::Request(msg) => assert_eq!(msg.sender, other),
msg => panic!("unexpected message popped: {:?}", msg),
}
}
assert!(!queues.has_input());
assert!(queues.pop_input().is_none());
} | rust_cleaned_test_functions.jsonl/44174 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 518
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
620,
16272,
29896,
26608,
6863,
4470,
11667,
10841,
368,
341,
262,
1077,
419,
284,
646,
1571,
4452,
842,
7,
16,
18,
317,
262,
1077,
1008,
284,
646,
1571,
4452,
842,
7,
16,
19,
626,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_too_many_vertices() {
/// This test checks that the tessellator returns the proper error when
/// the geometry builder run out of vertex ids.
struct Builder {
max_vertices: u32,
}
impl GeometryBuilder for Builder {
fn begin_geometry(&mut self) {}
fn add_triangle(&mut self, _a: VertexId, _b: VertexId, _c: VertexId) {}
fn end_geometry(&mut self) -> Count {
Count {
vertices: 0,
indices: 0,
}
}
fn abort_geometry(&mut self) {}
}
impl FillGeometryBuilder for Builder {
fn add_fill_vertex(&mut self, _: FillVertex) -> Result<VertexId, GeometryBuilderError> {
if self.max_vertices == 0 {
return Err(GeometryBuilderError::TooManyVertices);
}
self.max_vertices -= 1;
Ok(VertexId(self.max_vertices))
}
}
let mut path = Path::builder().with_svg();
build_logo_path(&mut path);
let path = path.build();
let mut tess = FillTessellator::new();
let options = FillOptions::tolerance(0.05);
assert_eq!(
tess.tessellate(&path, &options, &mut Builder { max_vertices: 0 }),
Err(TessellationError::TooManyVertices),
);
assert_eq!(
tess.tessellate(&path, &options, &mut Builder { max_vertices: 10 }),
Err(TessellationError::TooManyVertices),
);
assert_eq!(
tess.tessellate(&path, &options, &mut Builder { max_vertices: 100 }),
Err(TessellationError::TooManyVertices),
);
} | rust_cleaned_test_functions.jsonl/102390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 721
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
78,
22101,
37720,
368,
341,
262,
1048,
1096,
1273,
12341,
429,
279,
79830,
613,
850,
4675,
279,
6169,
1465,
979,
198,
262,
1048,
279,
17047,
7363,
1598,
700,
315,
11936,
14151,
382,
262,
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_device_id_is_an_uplink() {
let mut test_config = create_test_config_no_paths();
test_config.device_config = Some(build_full_config());
match test_config.device_id_is_an_uplink("/dev/sys/pci/test_wan_up_id/ethernet") {
true => (),
false => panic!("Got unexpected 'false' value"),
}
match test_config.device_id_is_an_uplink("does_not_exist") {
true => panic!("Got unexpected 'true' value"),
false => (),
}
match test_config.device_id_is_an_uplink("/dev/sys/pci/test_lan_up_id/ethernet") {
true => panic!("Got unexpected 'true' value"),
false => (),
}
} | rust_cleaned_test_functions.jsonl/83810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9204,
842,
6892,
12008,
8237,
2080,
368,
341,
286,
1077,
5206,
1273,
5332,
284,
1855,
4452,
5332,
6536,
24152,
543,
286,
1273,
5332,
18355,
5332,
284,
4329,
43333,
16372,
5332,
1423,
286,
2432,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_parse_valid_autoscaling_describe_tags() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"autoscaling-describe-tags.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
AutoscalingClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = DescribeTagsType::default();
let result = client.describe_tags(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/8947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
32808,
436,
81552,
15768,
3114,
16333,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
79301,
815... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arc_unsized() {
unsafe {
let pointer_ops = DefaultPointerOps::<Arc<_>>::new();
let p = Arc::new(1) as Arc<dyn Debug>;
let a: *const dyn Debug = &*p;
let b: (usize, usize) = mem::transmute(a);
let r = pointer_ops.into_raw(p);
assert_eq!(a, r);
assert_eq!(b, mem::transmute(r));
let p2: Arc<dyn Debug> = pointer_ops.from_raw(r);
let a2: *const dyn Debug = &*p2;
assert_eq!(a, a2);
assert_eq!(b, mem::transmute(a2));
}
} | rust_cleaned_test_functions.jsonl/82638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62914,
4907,
82,
1506,
368,
341,
286,
19860,
341,
310,
1077,
7445,
21959,
284,
7899,
9084,
38904,
27638,
36809,
32399,
77595,
931,
543,
310,
1077,
281,
284,
19689,
486,
931,
7,
16,
8,
438,
19689... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_one_tag() {
let template = DocumentTemplate::with_partials(&[
Partial::StringLiteral("Hello ".to_string()),
Partial::Tag("name".to_string()),
Partial::StringLiteral(", welcome!".to_string()),
]);
let filled_document = template
.saturate(&[TagPair {
key: "name".to_string(),
value: "Joe".to_string(),
}])
.unwrap();
let expected_string = "Hello Joe, welcome!".to_string();
assert_eq!(expected_string, filled_document.document());
} | rust_cleaned_test_functions.jsonl/48653 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
9372,
368,
341,
286,
1077,
3811,
284,
11789,
7275,
486,
4197,
10495,
10309,
2099,
9640,
310,
24552,
486,
703,
17350,
445,
9707,
5933,
983,
3904,
14702,
310,
24552,
486,
5668,
445,
606,
3263... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_domain_roundtrip() {
for example in [DOMAIN_STRING, NODENAME_DOMAIN_STRING] {
let domain = DomainBuilder::from_str(example).unwrap();
let mut buf = make_buf(domain.bytes_len());
domain.serialize_to_buf(buf.as_mut_slice());
let mut bv = BufferViewWrapper(buf.as_slice());
let parsed = Domain::parse(&mut bv, None).unwrap();
assert_eq!(example, format!("{}", parsed));
}
} | rust_cleaned_test_functions.jsonl/34434 | {
"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,
20111,
29896,
32981,
368,
341,
286,
369,
3110,
304,
508,
57125,
12283,
11,
451,
2069,
67329,
33729,
12283,
60,
341,
310,
1077,
7947,
284,
21070,
3297,
486,
1499,
2895,
66203,
568,
15454,
543,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_reached_leader_slot() {
solana_logger::setup();
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
.expect("Expected to be able to open database ledger");
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(2);
let bank0 = Arc::new(Bank::new_for_tests(&genesis_config));
let prev_hash = bank0.last_blockhash();
let (mut poh_recorder, _entry_receiver, _record_receiver) = PohRecorder::new(
0,
prev_hash,
bank0.clone(),
None,
bank0.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank0)),
&Arc::new(PohConfig::default()),
Arc::new(AtomicBool::default()),
);
assert_eq!(
poh_recorder.reached_leader_slot(),
PohLeaderStatus::NotReached
);
assert_eq!(bank0.slot(), 0);
poh_recorder.reset(bank0.clone(), None);
assert_eq!(
poh_recorder.reached_leader_slot(),
PohLeaderStatus::NotReached
);
// Provide a leader slot one slot down
poh_recorder.reset(bank0.clone(), Some((2, 2)));
let init_ticks = poh_recorder.tick_height();
// Send one slot worth of ticks
for _ in 0..bank0.ticks_per_slot() {
poh_recorder.tick();
}
// Tick should be recorded
assert_eq!(
poh_recorder.tick_height(),
init_ticks + bank0.ticks_per_slot()
);
let parent_meta = SlotMeta {
received: 1,
..SlotMeta::default()
};
poh_recorder
.blockstore
.put_meta_bytes(0, &serialize(&parent_meta).unwrap())
.unwrap();
// Test that we don't reach the leader slot because of grace ticks
assert_eq!(
poh_recorder.reached_leader_slot(),
PohLeaderStatus::NotReached
);
// reset poh now. we should immediately be leader
let bank1 = Arc::new(Bank::new_from_parent(&bank0, &Pubkey::default(), 1));
assert_eq!(bank1.slot(), 1);
poh_recorder.reset(bank1.clone(), Some((2, 2)));
assert_eq!(
poh_recorder.reached_leader_slot(),
PohLeaderStatus::Reached {
poh_slot: 2,
parent_slot: 1,
}
);
// Now test that with grace ticks we can reach leader slot
// Set the leader slot one slot down
poh_recorder.reset(bank1.clone(), Some((3, 3)));
for _ in 0..bank1.ticks_per_slot() {
poh_recorder.tick();
}
assert_eq!(
poh_recorder.reached_leader_slot(),
PohLeaderStatus::NotReached
);
// Send the grace ticks
for _ in 0..bank1.ticks_per_slot() / GRACE_TICKS_FACTOR {
poh_recorder.tick();
}
// We should be the leader now
assert_eq!(
poh_recorder.reached_leader_slot(),
PohLeaderStatus::Reached {
poh_slot: 3,
parent_slot: 1,
}
);
// Let's test that correct grace ticks are reported
// Set the leader slot one slot down
let bank2 = Arc::new(Bank::new_from_parent(&bank1, &Pubkey::default(), 2));
poh_recorder.reset(bank2.clone(), Some((4, 4)));
// send ticks for a slot
for _ in 0..bank1.ticks_per_slot() {
poh_recorder.tick();
}
assert_eq!(
poh_recorder.reached_leader_slot(),
PohLeaderStatus::NotReached
);
let bank3 = Arc::new(Bank::new_from_parent(&bank2, &Pubkey::default(), 3));
assert_eq!(bank3.slot(), 3);
poh_recorder.reset(bank3.clone(), Some((4, 4)));
assert_eq!(
poh_recorder.reached_leader_slot(),
PohLeaderStatus::Reached {
poh_slot: 4,
parent_slot: 3,
}
);
// Let's test that if a node overshoots the ticks for its target
// Set the leader slot one slot down
let bank4 = Arc::new(Bank::new_from_parent(&bank3, &Pubkey::default(), 4));
poh_recorder.reset(bank4.clone(), Some((5, 5)));
// Overshoot ticks for the slot
let overshoot_factor = 4;
for _ in 0..overshoot_factor * bank4.ticks_per_slot() {
poh_recorder.tick();
}
// We are overdue to lead
assert_eq!(
poh_recorder.reached_leader_slot(),
PohLeaderStatus::Reached {
poh_slot: 9,
parent_slot: 4,
}
);
}
Blockstore::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/106275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3099
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
3854,
79991,
27563,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
4314,
284,
8362,
4314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rook_moves() {
let position = PositionBuilder::new()
.place(Square::E4, Piece::Rook, Color::White)
.build();
let moves = MoveGenerator::new().moves(&position);
assert_targets(
&[
Square::E1,
Square::E2,
Square::E3,
Square::E5,
Square::E6,
Square::E7,
Square::E8,
Square::A4,
Square::B4,
Square::C4,
Square::D4,
Square::F4,
Square::G4,
Square::H4,
],
&moves,
);
let position = PositionBuilder::new()
.place(Square::E2, Piece::Rook, Color::White)
.place(Square::E4, Piece::Knight, Color::White)
.place(Square::D2, Piece::Knight, Color::Black)
.build();
let mut moves = Vec::new();
MoveGenerator::new().moves_from(
Kind::All,
&mut moves,
&position,
Color::White,
Square::E2,
);
assert_targets(
&[
Square::E1,
Square::E3,
Square::D2,
Square::F2,
Square::G2,
Square::H2,
],
&moves,
);
} | rust_cleaned_test_functions.jsonl/134604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 596
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26608,
562,
45390,
368,
341,
262,
1077,
2309,
284,
12380,
3297,
486,
931,
741,
414,
659,
2007,
3759,
5151,
486,
36,
19,
11,
28930,
486,
49,
1941,
11,
3478,
486,
14075,
340,
414,
659,
5834,
543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ignore_message_from_prev_height() {
let sandbox = timestamping_sandbox();
let sandbox_state = SandboxState::new();
add_one_height(&sandbox, &sandbox_state);
sandbox.assert_state(Height(2), Round(1));
let propose = ProposeBuilder::new(&sandbox)
.with_height(Height(0))//without this line some Prevote will be sent
.build();
sandbox.recv(&propose);
} | rust_cleaned_test_functions.jsonl/35539 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
6462,
5673,
25566,
9561,
368,
341,
262,
1077,
42754,
284,
11441,
287,
643,
31536,
543,
262,
1077,
42754,
4387,
284,
96860,
1397,
486,
931,
1428,
262,
912,
11667,
9561,
2099,
76756,
11,
609,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_op_parse_implicit_value() {
// Doesn't matter for this test.
let encoding = encoding4();
let data = b"hello";
check_op_parse(
|s| {
s.D8(constants::DW_OP_implicit_value.0)
.uleb(data.len() as u64)
.append_bytes(&data[..])
},
&Operation::ImplicitValue {
data: EndianSlice::new(&data[..], LittleEndian),
},
encoding,
);
} | rust_cleaned_test_functions.jsonl/45755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
21039,
62,
30940,
3142,
368,
341,
286,
442,
48832,
944,
4925,
369,
419,
1273,
624,
286,
1077,
11170,
284,
11170,
19,
1428,
286,
1077,
821,
284,
293,
1,
14990,
3302,
286,
1779,
10287,
2103... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calc_max_happiness() {
let mut pair_opt = PairOpt::new();
pair_opt.add_pair("Alice", "Bob", 54);
pair_opt.add_pair("Alice", "Carol", -79);
pair_opt.add_pair("Alice", "David", -2);
pair_opt.add_pair("Bob", "Alice", 83);
pair_opt.add_pair("Bob", "Carol", -7);
pair_opt.add_pair("Bob", "David", -63);
pair_opt.add_pair("Carol", "Alice", -62);
pair_opt.add_pair("Carol", "Bob", 60);
pair_opt.add_pair("Carol", "David", 55);
pair_opt.add_pair("David", "Alice", 46);
pair_opt.add_pair("David", "Bob", -7);
pair_opt.add_pair("David", "Carol", 41);
assert_eq!(330, calc_max_happiness(&pair_opt));
} | rust_cleaned_test_functions.jsonl/85259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38241,
6345,
1523,
66291,
368,
341,
262,
1077,
5206,
6716,
15032,
284,
25995,
21367,
486,
931,
543,
262,
6716,
15032,
1364,
14445,
445,
61686,
497,
330,
32388,
497,
220,
20,
19,
317,
262,
6716,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rw() -> Result<()> {
let path: PathBuf = tempdir().unwrap().path().into();
let store = Store::with_dir(path.clone());
let ns = Namespace::default();
let name = Name::from_str("users").unwrap();
store.save_ns(name.clone(), ns.clone())?;
let saved_ns = store.get_ns(path.join("users"))?;
assert_eq!(saved_ns, ns);
Ok(())
} | rust_cleaned_test_functions.jsonl/87605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49566,
368,
1464,
5714,
71698,
341,
286,
1077,
1815,
25,
7933,
15064,
284,
2730,
3741,
1005,
15454,
1005,
2343,
1005,
18122,
543,
286,
1077,
3553,
284,
9129,
486,
4197,
4334,
5581,
15997,
1423,
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... | 3 |
#[test]
fn test_qualify_path_generic() {
check_assist(
add_missing_impl_members,
"
mod foo {
pub struct Bar<T>;
trait Foo { fn foo(&self, bar: Bar<u32>); }
}
struct S;
impl foo::Foo for S { <|> }",
"
mod foo {
pub struct Bar<T>;
trait Foo { fn foo(&self, bar: Bar<u32>); }
}
struct S;
impl foo::Foo for S {
<|>fn foo(&self, bar: foo::Bar<u32>) { unimplemented!() }
}",
);
} | rust_cleaned_test_functions.jsonl/106817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64391,
1437,
2638,
41232,
368,
341,
286,
1779,
12083,
380,
1006,
310,
912,
40447,
21007,
30397,
345,
310,
6228,
2593,
15229,
341,
262,
6675,
2036,
4716,
3125,
10133,
262,
17567,
33428,
314,
5168,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_time_offset_amount() {
let p = Parser::new();
assert_eq!(p.time_offset_amount("+12:34").1,
Done("", TimeOffsetAmount::new_str("+", "12", "34"))
);
} | rust_cleaned_test_functions.jsonl/27415 | {
"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,
3009,
6917,
13471,
368,
341,
262,
1077,
281,
284,
21102,
486,
931,
543,
262,
2060,
10714,
10297,
79,
6378,
6917,
13471,
34973,
16,
17,
25,
18,
19,
1827,
16,
345,
414,
27357,
19814,
4120,
6446,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_convenience_builder() {
use super::{Metadata, Record};
let target = "myApp";
let metadata = Metadata::builder().target(target).build();
let fmt_args = format_args!("hello");
let record_test = Record::builder()
.args(fmt_args)
.metadata(metadata)
.module_path(Some("foo"))
.file(Some("bar"))
.line(Some(30))
.build();
assert_eq!(record_test.target(), "myApp");
assert_eq!(record_test.module_path(), Some("foo"));
assert_eq!(record_test.file(), Some("bar"));
assert_eq!(record_test.line(), Some(30));
} | rust_cleaned_test_functions.jsonl/71740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
3382,
39547,
28532,
368,
341,
286,
990,
2256,
22964,
14610,
11,
13583,
2440,
286,
1077,
2169,
284,
330,
2408,
2164,
876,
286,
1077,
11160,
284,
33589,
486,
17850,
1005,
5657,
8637,
568,
583... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_valid_buf() {
let buf = [
0b10101011,
];
let expected = NonSupportedCommandParams { cr_bit: true, non_supported_command: 42 };
assert_eq!(NonSupportedCommandParams::decode(&buf[..]).unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/67132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
8337,
10363,
368,
341,
286,
1077,
6607,
284,
2278,
310,
220,
15,
65,
16,
15,
16,
15,
16,
15,
16,
16,
11,
715,
286,
9747,
286,
1077,
3601,
284,
11581,
34636,
4062,
4870,
314,
1560,
139... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tt_to_stmts() {
let stmts = parse_macro(
r#"
macro_rules! foo {
() => {
let a = 0;
a = 10 + 1;
a
}
}
"#,
)
.expand_statements("foo!{}");
assert_eq!(
format!("{:#?}", stmts).trim(),
r#"MACRO_STMTS@0..15
LET_STMT@0..7
LET_KW@0..3 "let"
IDENT_PAT@3..4
NAME@3..4
IDENT@3..4 "a"
EQ@4..5 "="
LITERAL@5..6
INT_NUMBER@5..6 "0"
SEMICOLON@6..7 ";"
EXPR_STMT@7..14
BIN_EXPR@7..13
PATH_EXPR@7..8
PATH@7..8
PATH_SEGMENT@7..8
NAME_REF@7..8
IDENT@7..8 "a"
EQ@8..9 "="
BIN_EXPR@9..13
LITERAL@9..11
INT_NUMBER@9..11 "10"
PLUS@11..12 "+"
LITERAL@12..13
INT_NUMBER@12..13 "1"
SEMICOLON@13..14 ";"
EXPR_STMT@14..15
PATH_EXPR@14..15
PATH@14..15
PATH_SEGMENT@14..15
NAME_REF@14..15
IDENT@14..15 "a""#,
);
} | rust_cleaned_test_functions.jsonl/28724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 698
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66740,
2346,
21824,
82,
368,
341,
262,
1077,
20020,
82,
284,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1719,
589,
341,
338,
1077,
264,
284,
220,
15,
280,
338,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_tx_single_recipient_dust_amount() {
let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
let addr = wallet.get_new_address().unwrap();
wallet
.create_tx(
TxBuilder::new()
.set_single_recipient(addr.script_pubkey())
.drain_wallet()
.fee_rate(FeeRate::from_sat_per_vb(453.0)),
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/11333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
17805,
19487,
7080,
14117,
814,
590,
13471,
368,
341,
286,
1077,
320,
35735,
11,
8358,
27439,
284,
633,
761,
36053,
62308,
5433,
4452,
1670,
20819,
71,
1423,
286,
1077,
10789,
284,
15085,
67... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shapeid_resolution_valid() {
let model: Model = ModelBuilder::new(Version::V10, "smithy.example")
.uses("foo.baz#Bar")
.simple_shape(SimpleShapeBuilder::string("MyString"))
.structure(
StructureBuilder::new("MyStructure")
.member("a", "MyString")
.member("b", "smithy.example#MyString")
.member("c", "Bar")
.member("d", "String")
.member("e", "MyBoolean")
.member("f", "InvalidShape")
.into(),
)
.simple_shape(SimpleShapeBuilder::boolean("MyBoolean"))
.try_into()
.unwrap();
assert!(!model.is_complete());
let lines = make_line_oriented_form(&model);
println!("{:#?}", lines);
assert_eq!(lines, EXPECTED_LINES);
} | rust_cleaned_test_functions.jsonl/25973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13597,
307,
39849,
8337,
368,
341,
262,
1077,
1614,
25,
4903,
284,
4903,
3297,
486,
931,
7,
5637,
486,
53,
16,
15,
11,
330,
33017,
88,
7724,
1138,
286,
659,
4776,
445,
7975,
948,
1370,
2,
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... | 1 |
#[test]
fn test_b2h() {
let b = "Hatsune Miku".as_bytes();
let h = b2h(b);
assert_eq!("48617473756e65204d696b75", h);
} | rust_cleaned_test_functions.jsonl/81060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
17,
71,
368,
341,
256,
1077,
293,
284,
330,
39,
1862,
2886,
386,
38242,
3263,
300,
12524,
543,
256,
1077,
305,
284,
293,
17,
71,
1883,
317,
256,
2060,
10714,
17223,
19,
23,
21,
16,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fs_root_of_unity() {
assert_eq!(Fs::multiplicative_generator(), Fs::from_repr(FsRepr::from(7)).unwrap());
assert_eq!(
Fs::multiplicative_generator().pow([
0xa677297dc392126f,
0xbab3eedb83920ee0,
0x5370a08b6d0302b0,
0x0060c89ce5c26340,
]),
Fs::root_of_unity()
);
assert_eq!(
Fs::root_of_unity().pow([1 << Fs::S]),
Fs::one()
);
assert!(Fs::multiplicative_generator().sqrt().is_none());
} | rust_cleaned_test_functions.jsonl/95524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34470,
12993,
3575,
62,
2439,
368,
341,
1066,
262,
2060,
10714,
10297,
48300,
486,
77976,
65266,
25813,
1507,
84619,
486,
1499,
68535,
7832,
82,
693,
649,
486,
1499,
7,
22,
4579,
15454,
1423,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_message() {
let dupe_key = Pubkey::new_unique();
let legacy_message_with_dupes = Message {
header: MessageHeader {
num_required_signatures: 1,
..MessageHeader::default()
},
account_keys: vec![dupe_key, dupe_key],
..Message::default()
};
assert_eq!(
SanitizedMessage::try_from(legacy_message_with_dupes).err(),
Some(SanitizeMessageError::DuplicateAccountKey),
);
let legacy_message_with_no_signers = Message {
account_keys: vec![Pubkey::new_unique()],
..Message::default()
};
assert_eq!(
SanitizedMessage::try_from(legacy_message_with_no_signers).err(),
Some(SanitizeMessageError::IndexOutOfBounds),
);
} | rust_cleaned_test_functions.jsonl/133927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
6462,
368,
341,
286,
1077,
3845,
375,
3097,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
19588,
6462,
6615,
51932,
288,
284,
4856,
341,
310,
4247,
25,
4856,
4047,
341,
394,
162... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_native_libs_tracking_hash_different_order() {
let mut v1 = Options::default();
let mut v2 = Options::default();
let mut v3 = Options::default();
// Reference
v1.libs = vec![
(String::from("a"), None, NativeLibKind::StaticBundle),
(String::from("b"), None, NativeLibKind::Framework),
(String::from("c"), None, NativeLibKind::Unspecified),
];
v2.libs = vec![
(String::from("b"), None, NativeLibKind::Framework),
(String::from("a"), None, NativeLibKind::StaticBundle),
(String::from("c"), None, NativeLibKind::Unspecified),
];
v3.libs = vec![
(String::from("c"), None, NativeLibKind::Unspecified),
(String::from("a"), None, NativeLibKind::StaticBundle),
(String::from("b"), None, NativeLibKind::Framework),
];
assert!(v1.dep_tracking_hash() == v2.dep_tracking_hash());
assert!(v1.dep_tracking_hash() == v3.dep_tracking_hash());
assert!(v2.dep_tracking_hash() == v3.dep_tracking_hash());
// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
} | rust_cleaned_test_functions.jsonl/16054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 520
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44494,
16142,
82,
66105,
8950,
82741,
7869,
368,
341,
262,
1077,
5206,
348,
16,
284,
14566,
486,
2258,
543,
262,
1077,
5206,
348,
17,
284,
14566,
486,
2258,
543,
262,
1077,
5206,
348,
18,
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_fn_trait() {
let closure = || 0;
let fn_trait_obj: &dyn Fn() -> i32 = &closure;
let pointer = Ptr::new(fn_trait_obj);
// Prove we can copy it.
let copy = pointer;
assert_eq!(pointer(), 0);
assert_eq!(copy(), 0);
} | rust_cleaned_test_functions.jsonl/24615 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
78491,
368,
341,
262,
1077,
21955,
284,
1369,
220,
15,
401,
262,
1077,
5168,
78491,
7328,
25,
609,
43085,
50182,
368,
1464,
600,
18,
17,
284,
609,
46916,
401,
262,
1077,
7445,
284,
46409,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_abbreviate_long_string_multiple_steps() {
let mut out = ProcOutput::new();
out.extend(&vec![b'.'; HEAD_LEN], &[]);
out.extend(&vec![b'.'; TAIL_LEN], &[]);
// Also test whether the rotation works
out.extend(&vec![b'!'; 16], &[]);
out.extend(&vec![b'?'; 16], &[]);
let mut expected = vec![b'.'; HEAD_LEN];
expected.extend_from_slice(b"\n\n<<<<<< SKIPPED 32 BYTES >>>>>>\n\n");
expected.extend_from_slice(&vec![b'.'; TAIL_LEN - 32]);
expected.extend_from_slice(&vec![b'!'; 16]);
expected.extend_from_slice(&vec![b'?'; 16]);
// `out` is hundreds of KBs in size.
let out = out.into_bytes();
assert_eq!(expected.len(), out.len());
assert_eq!(expected, out);
} | rust_cleaned_test_functions.jsonl/34995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
44272,
6493,
17799,
3904,
45233,
22731,
368,
341,
262,
1077,
5206,
700,
284,
41087,
5097,
486,
931,
1428,
262,
700,
15831,
2099,
4083,
20703,
65,
6,
3159,
26,
33080,
15536,
1125,
609,
56703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_byte_syntax() {
new_ucmd!()
.args(&["-1c"])
.pipe_in("abc")
.run()
.stdout_is("a");
} | rust_cleaned_test_functions.jsonl/32764 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
78894,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
16,
66,
14108,
286,
659,
13768,
1243,
445,
13683,
1138,
286,
659,
6108,
741,
286,
659,
36358,
6892,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_is_valid() {
let a = Int32Array::from(vec![
Some(15),
None,
None,
Some(1),
None,
None,
Some(5),
None,
None,
Some(4),
]);
let simd_lanes = 16;
let data = a.data();
let bitmap = data.null_bitmap();
let result = unsafe { is_valid::<Int32Type>(&bitmap, 0, simd_lanes, a.len()) };
for i in 0..simd_lanes {
if i % 3 != 0 || i > 9 {
assert_eq!(false, result.extract(i));
} else {
assert_eq!(true, result.extract(i));
}
}
} | rust_cleaned_test_functions.jsonl/16033 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
8337,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
90515,
310,
4329,
7,
16,
20,
1326,
310,
2240,
345,
310,
2240,
345,
310,
4329,
7,
16,
1326,
310,
2240,
345,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_very_small_turn_sums() {
let lang = English;
let words = Words::new(lang);
let guessed = vec![];
let cache = Cache::new(&words);
let log = true;
let count = 4;
let secrets: SecretIndices = words.secret_indices().into_iter().take(count).collect();
let scores = turn_sums(&words, &secrets, &guessed, &cache, count, log);
let (_, min) = scores.first().unwrap();
let count = scores.iter().filter(|(_, s)| s == min).count();
println!(
"Turn sums {} ({} have value {}, avg {:.2})",
words.scores_to_string(&scores, 5),
count,
min,
*min as f64 / secrets.len() as f64
);
for (_, score) in scores {
assert_eq!(score, 8);
}
} | rust_cleaned_test_functions.jsonl/57273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
1204,
31966,
37274,
643,
6237,
368,
341,
262,
1077,
8688,
284,
6364,
280,
262,
1077,
4244,
284,
27630,
486,
931,
49493,
317,
262,
1077,
42310,
284,
7486,
0,
15078,
262,
1077,
6500,
284,
1947... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fq_squaring() {
let a = Fq([
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0x19ffffffffffffff,
]);
assert!(a.is_valid());
assert_eq!(
a.square(),
Fq::from_repr(FqRepr([
0x02, 0x4b, 0xcb, 0xe5, 0xd5, 0x1b, 0x9a, 0x6f, 0x79, 0x36, 0x1e, 0x5a, 0x80, 0x2c,
0x6a, 0x23, 0xdc, 0x05, 0xc6, 0x59, 0xb4, 0xe1, 0x5b, 0x27, 0xcc, 0xe1, 0xd4, 0xed,
0xc1, 0x20, 0xe6, 0x6e, 0x02, 0x4c, 0xbe, 0x17, 0x31, 0x57, 0x7a, 0x59, 0x1c, 0xfb,
0x28, 0xfe, 0x7d, 0xfb, 0xbb, 0x86,
]))
.unwrap()
);
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
0xe5,
]);
for _ in 0..1000000 {
let a = Fq::random(&mut rng);
assert_eq!(a.square(), a * a);
}
} | rust_cleaned_test_functions.jsonl/79189 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 641
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
643,
446,
3249,
368,
341,
262,
1077,
264,
284,
434,
80,
8956,
286,
220,
15,
41798,
53697,
345,
286,
220,
15,
41798,
53697,
345,
286,
220,
15,
41798,
53697,
345,
286,
220,
15,
41798,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_two_plus_lines_spaces_and_ansi() {
DeltaTest::with_args(&[
"--side-by-side",
"--width",
"41",
"--line-fill-method=spaces",
])
.explain_ansi()
.with_input(TWO_PLUS_LINES_DIFF)
.expect_after_header(r#"
(blue)│(88) (blue)│(normal) (blue)│(28) 1 (blue)│(231 22)a (203)=(231) (141)1(normal 22) (normal)
(blue)│(88) (blue)│(normal) (blue)│(28) 2 (blue)│(231 22)b (203)=(231) (141)234567(normal 22) (normal)"#);
DeltaTest::with_args(&[
"--side-by-side",
"--width",
"41",
"--line-fill-method=ansi",
])
.explain_ansi()
.with_input(TWO_PLUS_LINES_DIFF)
.expect_after_header(r#"
(blue)│(88) (blue)│(normal) (blue) │(28) 1 (blue)│(231 22)a (203)=(231) (141)1(normal)
(blue)│(88) (blue)│(normal) (blue) │(28) 2 (blue)│(231 22)b (203)=(231) (141)234567(normal)"#);
} | rust_cleaned_test_functions.jsonl/72595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 663
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
28043,
18323,
67883,
8378,
62,
52067,
368,
341,
286,
24957,
2271,
486,
4197,
8384,
2099,
9640,
310,
14482,
2929,
14319,
24067,
756,
310,
14482,
3098,
756,
310,
330,
19,
16,
756,
310,
14482,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_circular_index_empty() {
// Empty.
assert_eq!(empty(0, 0, 10, !0), (0..10, None));
assert_eq!(empty(0, 0, 10, 1), (0..1, None));
// Empty with position in the middle.
assert_eq!(empty(5, 0, 10, !0), (5..10, Some(0..5)));
assert_eq!(empty(5, 0, 10, 1), (5..6, None));
// Fully occupied.
assert_eq!(empty(0, 10, 10, !0), (10..10, None));
assert_eq!(empty(0, 10, 10, 1), (10..10, None));
// Occupied only in the left half.
assert_eq!(empty(0, 5, 10, !0), (5..10, None));
assert_eq!(empty(0, 5, 10, 1), (5..6, None));
// Occupied only in the right half.
assert_eq!(empty(5, 5, 10, !0), (0..5, None));
assert_eq!(empty(5, 5, 10, 1), (0..1, None));
// Occupied only in the middle.
assert_eq!(empty(2, 6, 10, !0), (8..10, Some(0..2)));
assert_eq!(empty(2, 6, 10, 2), (8..10, None));
assert_eq!(empty(2, 6, 10, 3), (8..10, Some(0..1)));
// Fully occupied overflowing the end.
assert_eq!(empty(5, 10, 10, !0), (5..5, None));
} | rust_cleaned_test_functions.jsonl/86390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
21472,
3560,
15124,
368,
341,
262,
442,
22228,
624,
262,
2060,
10714,
10297,
3194,
7,
15,
11,
220,
15,
11,
220,
16,
15,
11,
753,
15,
701,
320,
15,
496,
16,
15,
11,
2240,
3237,
1066,
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_invalid_mbtc_conversion() {
INVALID_TEST_AMOUNTS
.iter()
.for_each(|amounts| test_from_mbtc(amounts.milli_bit, BitcoinAmount(amounts.satoshi)));
} | rust_cleaned_test_functions.jsonl/131273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
53812,
10413,
64132,
368,
341,
394,
32269,
11641,
59993,
50,
198,
503,
659,
2015,
741,
503,
659,
1958,
32046,
22428,
6045,
82,
91,
1273,
5673,
53812,
10413,
33989,
82,
744,
57168,
13996,
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 |
#[test]
fn test_path_dependency_under_member() {
let p = project()
.file(
"ws/Cargo.toml",
r#"
[project]
name = "ws"
version = "0.1.0"
authors = []
[dependencies]
foo = { path = "../foo" }
[workspace]
"#,
).file(
"ws/src/lib.rs",
r"extern crate foo; pub fn f() { foo::f() }",
).file(
"foo/Cargo.toml",
r#"
[project]
workspace = "../ws"
name = "foo"
version = "0.1.0"
authors = []
[dependencies]
bar = { path = "./bar" }
"#,
).file(
"foo/src/lib.rs",
"extern crate bar; pub fn f() { bar::f() }",
).file("foo/bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
.file("foo/bar/src/lib.rs", "pub fn f() { }");
let p = p.build();
p.cargo("build").cwd(p.root().join("ws")).run();
assert!(!p.root().join("foo/bar/Cargo.lock").is_file());
assert!(!p.root().join("foo/bar/target").is_dir());
p.cargo("build").cwd(p.root().join("foo/bar")).run();
assert!(!p.root().join("foo/bar/Cargo.lock").is_file());
assert!(!p.root().join("foo/bar/target").is_dir());
} | rust_cleaned_test_functions.jsonl/119802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 748
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
62387,
58228,
19388,
368,
341,
262,
1077,
281,
284,
2390,
741,
286,
659,
1192,
1006,
310,
330,
8915,
11295,
12088,
73494,
75,
756,
310,
435,
2,
698,
310,
508,
4987,
921,
310,
829,
284,
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_endian_vec() {
let mut w = EndianVec::new(LittleEndian);
assert_eq!(w.endian(), LittleEndian);
assert_eq!(w.len(), 0);
w.write(&[1, 2]).unwrap();
assert_eq!(w.slice(), &[1, 2]);
assert_eq!(w.len(), 2);
w.write(&[3, 4, 5]).unwrap();
assert_eq!(w.slice(), &[1, 2, 3, 4, 5]);
assert_eq!(w.len(), 5);
w.write_at(0, &[6, 7]).unwrap();
assert_eq!(w.slice(), &[6, 7, 3, 4, 5]);
assert_eq!(w.len(), 5);
w.write_at(3, &[8, 9]).unwrap();
assert_eq!(w.slice(), &[6, 7, 3, 8, 9]);
assert_eq!(w.len(), 5);
assert_eq!(w.write_at(4, &[6, 7]), Err(Error::LengthOutOfBounds));
assert_eq!(w.write_at(5, &[6, 7]), Err(Error::LengthOutOfBounds));
assert_eq!(w.write_at(6, &[6, 7]), Err(Error::OffsetOutOfBounds));
assert_eq!(w.into_vec(), vec![6, 7, 3, 8, 9]);
} | rust_cleaned_test_functions.jsonl/109600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 510
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87193,
13251,
368,
341,
286,
1077,
5206,
289,
284,
3972,
1103,
10050,
486,
931,
4957,
2377,
43231,
317,
286,
2060,
10714,
10297,
86,
5073,
1103,
1507,
14671,
43231,
317,
286,
2060,
10714,
10297,
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_load_config() {
#[derive(Clone, ModuleConfig)]
struct TestConfig<'a> {
pub symbol: &'a str,
pub disabled: bool,
pub some_array: Vec<&'a str>,
}
let config = toml::toml! {
symbol = "T "
disabled = true
some_array = ["A"]
};
let default_config = TestConfig {
symbol: "S ",
disabled: false,
some_array: vec!["A", "B", "C"],
};
let rust_config = default_config.load_config(&config);
assert_eq!(rust_config.symbol, "T ");
assert_eq!(rust_config.disabled, true);
assert_eq!(rust_config.some_array, vec!["A"]);
} | rust_cleaned_test_functions.jsonl/76120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
5332,
368,
341,
286,
11506,
27098,
65297,
11,
13711,
2648,
5563,
286,
2036,
3393,
2648,
18291,
64,
29,
341,
310,
6675,
7735,
25,
30136,
64,
607,
345,
310,
6675,
8386,
25,
1807,
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,
1,
1,
1... | 1 |
#[test]
fn test_into_bits_strict() {
let mut negone = Fr::one();
negone.negate();
let mut cs = TestConstraintSystem::<Bls12>::new();
let n = AllocatedNum::alloc(&mut cs, || Ok(negone)).unwrap();
n.into_bits_le_strict(&mut cs).unwrap();
assert!(cs.is_satisfied());
// make the bit representation the characteristic
cs.set("bit 254/boolean", Fr::one());
// this makes the conditional boolean constraint fail
assert_eq!(cs.which_is_unsatisfied().unwrap(), "bit 254/boolean constraint");
} | rust_cleaned_test_functions.jsonl/36362 | {
"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,
45514,
20034,
2895,
849,
368,
341,
286,
1077,
5206,
4184,
603,
284,
2869,
486,
603,
543,
286,
4184,
603,
79219,
349,
1428,
286,
1077,
5206,
10532,
284,
3393,
17890,
2320,
27638,
33,
4730,
16,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_stringview() {
// Test that APIs using std::string_view do not otherwise cause errors.
let hdr = indoc! {"
#include <string_view>
#include <string>
void take_string_view(std::string_view) {}
std::string_view return_string_view(std::string a) { return std::string_view(a); }
"};
let rs = quote! {};
run_test_ex(
"",
hdr,
rs,
directives_from_lists(&["take_string_view", "return_string_view"], &[], None),
make_clang_arg_adder(&["-std=c++17"]),
None,
None,
);
} | rust_cleaned_test_functions.jsonl/9911 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
1050,
368,
341,
262,
442,
3393,
429,
33356,
1667,
1460,
486,
917,
7122,
653,
537,
5937,
5240,
5975,
624,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
917,
7122,
397... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_const_creation() {
const EMPTY: CompactString = CompactString::new_inline("");
const SHORT: CompactString = CompactString::new_inline("rust");
#[cfg(target_pointer_width = "64")]
const PACKED: CompactString = CompactString::new_inline("i am 24 characters long!");
#[cfg(target_pointer_width = "32")]
const PACKED: CompactString = CompactString::new_inline("i am 12 char");
assert_eq!(EMPTY, CompactString::new(""));
assert_eq!(SHORT, CompactString::new("rust"));
#[cfg(target_pointer_width = "64")]
assert_eq!(PACKED, CompactString::new("i am 24 characters long!"));
#[cfg(target_pointer_width = "32")]
assert_eq!(PACKED, CompactString::new("i am 12 char"));
} | rust_cleaned_test_functions.jsonl/47698 | {
"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,
13610,
46163,
368,
341,
262,
733,
41314,
25,
54782,
703,
284,
54782,
703,
486,
931,
41871,
13056,
262,
733,
64924,
25,
54782,
703,
284,
54782,
703,
486,
931,
41871,
445,
35788,
3071,
262,
11506,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_stream() {
let mut out = Vec::new();
{
let mut writer = BitStreamWriter::new(&mut out);
writer.write(0, 1).unwrap();
writer.write(2, 2).unwrap();
writer.write(6, 3).unwrap();
writer.write(11, 4).unwrap();
writer.write(1, 5).unwrap();
writer.write(32, 6).unwrap();
writer.write(7, 7).unwrap();
writer.flush().unwrap();
}
let bytes = out;
assert_eq!("01011010110000110000000001110000", format!("{:08b}{:08b}{:08b}{:08b}", bytes[0], bytes[1], bytes[2], bytes[3]));
{
let mut input = Cursor::new(bytes);
let mut reader = BitStreamReader::new(&mut input);
assert_eq!(reader.read(1).unwrap(), 0);
assert_eq!(reader.read(2).unwrap(), 2);
assert_eq!(reader.read(3).unwrap(), 6);
assert_eq!(reader.read(4).unwrap(), 11);
assert_eq!(reader.read(5).unwrap(), 1);
assert_eq!(reader.read(6).unwrap(), 32);
assert_eq!(reader.read(7).unwrap(), 7);
// 4 bits remained
assert!(reader.read(5).is_err());
}
} | rust_cleaned_test_functions.jsonl/49374 | {
"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,
13996,
12673,
368,
341,
286,
1077,
5206,
700,
284,
11312,
486,
931,
543,
286,
341,
310,
1077,
5206,
6916,
284,
6495,
93031,
486,
931,
2099,
6984,
700,
317,
310,
6916,
3836,
7,
15,
11,
220,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_extract() {
let mut router = Router::<()>::build();
router.path("/{key}/{value}/", ());
let router = router.finish();
let mut path = Path::new("/name/user1/");
assert!(router.recognize(&mut path).is_some());
let s: MyStruct = de::Deserialize::deserialize(PathDeserializer::new(&path)).unwrap();
assert_eq!(s.key, "name");
assert_eq!(s.value, "user1");
let s: (String, String) =
de::Deserialize::deserialize(PathDeserializer::new(&path)).unwrap();
assert_eq!(s.0, "name");
assert_eq!(s.1, "user1");
let mut router = Router::<()>::build();
router.path("/{key}/{value}/", ());
let router = router.finish();
let mut path = Path::new("/name/32/");
assert!(router.recognize(&mut path).is_some());
let s: Test1 = de::Deserialize::deserialize(PathDeserializer::new(&path)).unwrap();
assert_eq!(s.0, "name");
assert_eq!(s.1, 32);
let s: Test2 = de::Deserialize::deserialize(PathDeserializer::new(&path)).unwrap();
assert_eq!(s.key, "name");
assert_eq!(s.value, 32);
let s: (String, u8) =
de::Deserialize::deserialize(PathDeserializer::new(&path)).unwrap();
assert_eq!(s.0, "name");
assert_eq!(s.1, 32);
let res: Vec<String> =
de::Deserialize::deserialize(PathDeserializer::new(&path)).unwrap();
assert_eq!(res[0], "name".to_owned());
assert_eq!(res[1], "32".to_owned());
} | rust_cleaned_test_functions.jsonl/36504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 744
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
39123,
368,
341,
286,
1077,
5206,
9273,
284,
10554,
27638,
368,
6831,
5834,
543,
286,
9273,
3875,
65871,
792,
22472,
957,
4472,
497,
49323,
286,
1077,
9273,
284,
9273,
40086,
1428,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_add_htlc_bolt2_sender_exceed_max_htlc_num_and_htlc_id_increment() {
//BOLT 2 Requirement: for the first HTLC it offers MUST set id to 0.
//BOLT 2 Requirement: MUST increase the value of id by 1 for each successive offer.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1000000, 0, InitFeatures::supported(), InitFeatures::supported());
let max_accepted_htlcs = nodes[1].node.channel_state.lock().unwrap().by_id.get(&chan.2).unwrap().their_max_accepted_htlcs as u64;
for i in 0..max_accepted_htlcs {
let route = nodes[0].router.get_route(&nodes[1].node.get_our_node_id(), None, &[], 100000, TEST_FINAL_CLTV).unwrap();
let (_, our_payment_hash) = get_payment_preimage_hash!(nodes[0]);
let payment_event = {
nodes[0].node.send_payment(route, our_payment_hash).unwrap();
check_added_monitors!(nodes[0], 1);
let mut events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
if let MessageSendEvent::UpdateHTLCs { node_id: _, updates: msgs::CommitmentUpdate{ update_add_htlcs: ref htlcs, .. }, } = events[0] {
assert_eq!(htlcs[0].htlc_id, i);
} else {
assert!(false);
}
SendEvent::from_event(events.remove(0))
};
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &payment_event.msgs[0]);
check_added_monitors!(nodes[1], 0);
commitment_signed_dance!(nodes[1], nodes[0], payment_event.commitment_msg, false);
expect_pending_htlcs_forwardable!(nodes[1]);
expect_payment_received!(nodes[1], our_payment_hash, 100000);
}
let route = nodes[0].router.get_route(&nodes[1].node.get_our_node_id(), None, &[], 100000, TEST_FINAL_CLTV).unwrap();
let (_, our_payment_hash) = get_payment_preimage_hash!(nodes[0]);
let err = nodes[0].node.send_payment(route, our_payment_hash);
if let Err(APIError::ChannelUnavailable{err}) = err {
assert_eq!(err, "Cannot push more than their max accepted HTLCs");
} else {
assert!(false);
}
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(), "Cannot push more than their max accepted HTLCs".to_string(), 1);
} | rust_cleaned_test_functions.jsonl/28324 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 983
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
2891,
49086,
17257,
880,
6181,
17,
54356,
2702,
4635,
6345,
49086,
17257,
4273,
8378,
49086,
17257,
842,
51482,
368,
341,
197,
322,
33,
35320,
220,
17,
75938,
25,
369,
279,
1156,
5260,
8556,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_commit() {
let l = default_logger();
let mut tests = vec![
// single
(vec![1], vec![empty_entry(1, 1)], 1, 1),
(vec![1], vec![empty_entry(1, 1)], 2, 0),
(vec![2], vec![empty_entry(1, 1), empty_entry(2, 2)], 2, 2),
(vec![1], vec![empty_entry(2, 1)], 2, 1),
// odd
(
vec![2, 1, 1],
vec![empty_entry(1, 1), empty_entry(2, 2)],
1,
1,
),
(
vec![2, 1, 1],
vec![empty_entry(1, 1), empty_entry(1, 2)],
2,
0,
),
(
vec![2, 1, 2],
vec![empty_entry(1, 1), empty_entry(2, 2)],
2,
2,
),
(
vec![2, 1, 2],
vec![empty_entry(1, 1), empty_entry(1, 2)],
2,
0,
),
// even
(
vec![2, 1, 1, 1],
vec![empty_entry(1, 1), empty_entry(2, 2)],
1,
1,
),
(
vec![2, 1, 1, 1],
vec![empty_entry(1, 1), empty_entry(1, 2)],
2,
0,
),
(
vec![2, 1, 1, 2],
vec![empty_entry(1, 1), empty_entry(2, 2)],
1,
1,
),
(
vec![2, 1, 1, 2],
vec![empty_entry(1, 1), empty_entry(1, 2)],
2,
0,
),
(
vec![2, 1, 2, 2],
vec![empty_entry(1, 1), empty_entry(2, 2)],
2,
2,
),
(
vec![2, 1, 2, 2],
vec![empty_entry(1, 1), empty_entry(1, 2)],
2,
0,
),
];
for (i, (matches, logs, sm_term, w)) in tests.drain(..).enumerate() {
let store = MemStorage::new_with_conf_state((vec![1], vec![]));
store.wl().append(&logs).unwrap();
let mut hs = HardState::default();
hs.term = sm_term;
store.wl().set_hardstate(hs);
let cfg = new_test_config(1, 5, 1);
let mut sm = new_test_raft_with_config(&cfg, store, &l);
for (j, v) in matches.iter().enumerate() {
let id = j as u64 + 1;
if sm.mut_prs().get(id).is_none() {
sm.apply_conf_change(&add_node(id)).unwrap();
let pr = sm.mut_prs().get_mut(id).unwrap();
pr.matched = *v;
pr.next_idx = *v + 1;
}
}
sm.maybe_commit();
if sm.raft_log.committed != w {
panic!("#{}: committed = {}, want {}", i, sm.raft_log.committed, w);
}
}
} | rust_cleaned_test_functions.jsonl/19105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1701
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36346,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
7032,
284,
7486,
90515,
286,
442,
3175,
198,
286,
320,
4083,
20703,
16,
1125,
7486,
20703,
3194,
9078,
7,
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... | 5 |
#[test]
fn test_transaction_duration() {
let json = r#"
{
"type": "transaction",
"timestamp": "2021-04-26T08:00:00+0100",
"start_timestamp": "2021-04-26T07:59:01+0100",
"release": "1.2.3",
"environment": "fake_environment",
"transaction": "mytransaction",
"contexts": {
"trace": {
"status": "ok"
}
}
}
"#;
let event = Annotated::from_json(json).unwrap();
let config: TransactionMetricsConfig = serde_json::from_str(
r#"
{
"extractMetrics": [
"sentry.transactions.transaction.duration"
]
}
"#,
)
.unwrap();
let mut metrics = vec![];
extract_transaction_metrics(&config, None, event.value().unwrap(), &mut metrics);
assert_eq!(metrics.len(), 1);
let duration_metric = &metrics[0];
assert_eq!(
duration_metric.name,
"sentry.transactions.transaction.duration"
);
assert_eq!(
duration_metric.unit,
MetricUnit::Duration(DurationPrecision::MilliSecond)
);
if let MetricValue::Distribution(value) = duration_metric.value {
assert_eq!(value, 59000.0); // millis
} else {
panic!(); // Duration must be set
}
assert_eq!(duration_metric.tags.len(), 4);
assert_eq!(duration_metric.tags["release"], "1.2.3");
assert_eq!(duration_metric.tags["transaction.status"], "ok");
assert_eq!(duration_metric.tags["environment"], "fake_environment");
assert_eq!(duration_metric.tags["transaction"], "mytransaction");
} | rust_cleaned_test_functions.jsonl/21930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 930
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
25454,
368,
341,
286,
1077,
2951,
284,
435,
2,
698,
286,
341,
310,
330,
1313,
788,
330,
13528,
756,
310,
330,
13035,
788,
330,
17,
15,
17,
16,
12,
15,
19,
12,
17,
21,
51,
15,
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... | 2 |
#[test]
fn test_template() {
assert_eq!(
html! {
span : Test::new(&32);
}
.into_string()
.unwrap(),
"<span><span>32</span></span>"
);
assert_eq!(
html! {
span : Test2::new(&32);
}
.into_string()
.unwrap(),
"<span><span>32</span></span>"
);
} | rust_cleaned_test_functions.jsonl/73248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8693,
368,
341,
262,
2060,
10714,
33673,
286,
5272,
0,
341,
310,
9390,
549,
3393,
486,
931,
2099,
18,
17,
317,
286,
456,
286,
659,
18122,
3904,
741,
286,
659,
15454,
3148,
286,
4055,
1480,
178... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_call_member5() {
let mut vm = VirtualMachine::new();
vm.add_class(Class::new(
"Point".to_owned(),
vec![
Field::new("x".to_owned(), TypeId::Int32),
Field::new("y".to_owned(), TypeId::Int32),
]
));
vm.add_function(Function::new(
FunctionDeclaration::with_managed_member("sum".to_owned(), TypeId::Class("Point".to_owned()), Vec::new(), TypeId::Int32),
vec![TypeId::Int32],
vec![
Instruction::LoadInt32(1314),
Instruction::StoreLocal(0),
Instruction::LoadArgument(0),
Instruction::LoadField("Point".to_owned(), "x".to_owned()),
Instruction::LoadLocal(0),
Instruction::Add,
Instruction::LoadArgument(0),
Instruction::LoadField("Point".to_owned(), "y".to_owned()),
Instruction::Add,
Instruction::Return,
]
)).unwrap();
vm.add_function(Function::new(
FunctionDeclaration::with_managed("main".to_owned(), Vec::new(), TypeId::Int32),
vec![TypeId::Class("Point".to_owned())],
vec![
Instruction::NewObject("Point".to_owned()),
Instruction::StoreLocal(0),
Instruction::LoadLocal(0),
Instruction::LoadInt32(4711),
Instruction::StoreField("Point".to_owned(), "x".to_owned()),
Instruction::LoadLocal(0),
Instruction::LoadInt32(1337),
Instruction::StoreField("Point".to_owned(), "y".to_owned()),
Instruction::LoadLocal(0),
Instruction::CallInstance(FunctionSignature::with_class("sum".to_owned(), TypeId::Class("Point".to_owned()), Vec::new())),
Instruction::Return,
]
)).unwrap();
let execution_result = vm.execute().unwrap();
assert_eq!(4711 + 1314 + 1337, execution_result);
} | rust_cleaned_test_functions.jsonl/17404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 864
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
19388,
20,
368,
341,
262,
1077,
5206,
10995,
284,
20721,
21605,
486,
931,
1428,
262,
10995,
1364,
4790,
31368,
486,
931,
1006,
286,
330,
2609,
3263,
983,
51973,
3148,
286,
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... | 1 |
#[test]
fn test_shll_reg() {
assert_emit!(0xC1, 0xE0, 0x02; emit_shll_reg(2, RAX));
assert_emit!(0x41, 0xC1, 0xE4, 0x07; emit_shll_reg(7, R12));
} | rust_cleaned_test_functions.jsonl/85413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
654,
4920,
368,
341,
286,
2060,
69082,
10297,
15,
12125,
16,
11,
220,
15,
12606,
15,
11,
220,
15,
87,
15,
17,
26,
16691,
3712,
654,
4920,
7,
17,
11,
431,
2954,
1106,
286,
2060,
69082,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rc4_override() {
let start_stream: Vec<u8> = "0123456789".as_bytes().to_vec();
let mut cart_stream:Vec<u8> = Vec::new();
let mut final_stream: Vec<u8> = Vec::new();
let key = "Test Da Key!".as_bytes().to_vec();
let opt_header = object! {"name": "testvalue"};
let opt_footer = object! {"rc4key": "Test Da Key!"};
cart::pack(&mut start_stream.as_slice(), &mut cart_stream, Some(opt_header.clone()), Some(opt_footer.clone()), Some(key.clone())).unwrap();
assert!(cart::is_cart(&cart_stream[..]));
let mut cart_cur = Cursor::new(cart_stream);
let (header, footer) = cart::unpack(&mut cart_cur, &mut final_stream, Some(key)).unwrap();
assert_eq!(opt_header, header);
assert_eq!(opt_footer, footer);
assert_eq!(start_stream, final_stream);
} | rust_cleaned_test_functions.jsonl/69925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30299,
19,
48576,
368,
341,
262,
1077,
1191,
12673,
25,
11312,
34837,
23,
29,
284,
330,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
3263,
300,
12524,
1005,
983,
13251,
543,
262,
1077,
5206,
7406... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_configure_vcpu() {
let (vm, mut vcpu) = setup_vcpu();
let vm_config = VmConfig::default();
let vm_mem = vm.memory().unwrap();
assert!(vcpu
.configure_x86_64(&vm_config, vm_mem, GuestAddress(0))
.is_ok());
// Test configure while using the T2 template.
let mut vm_config = VmConfig::default();
vm_config.cpu_template = Some(CpuFeaturesTemplate::T2);
assert!(vcpu
.configure_x86_64(&vm_config, vm_mem, GuestAddress(0))
.is_ok());
// Test configure while using the C3 template.
let mut vm_config = VmConfig::default();
vm_config.cpu_template = Some(CpuFeaturesTemplate::C3);
assert!(vcpu
.configure_x86_64(&vm_config, vm_mem, GuestAddress(0))
.is_ok());
} | rust_cleaned_test_functions.jsonl/1917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 407
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75887,
2273,
16475,
368,
341,
286,
1077,
320,
7338,
11,
5206,
348,
16475,
8,
284,
6505,
2273,
16475,
1428,
286,
1077,
10995,
5332,
284,
647,
76,
2648,
486,
2258,
543,
286,
1077,
10995,
12976,
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_walks_all_indexes() {
let dims = uvec2(100, 100);
let size = vec2(256.0, 256.0);
let generator = ProjectionGenerator::new(dims, size);
assert_eq!(10000, generator.iter().count());
} | rust_cleaned_test_functions.jsonl/6158 | {
"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,
56131,
82,
5705,
50161,
368,
341,
286,
1077,
40888,
284,
575,
4083,
17,
7,
16,
15,
15,
11,
220,
16,
15,
15,
317,
286,
1077,
1379,
284,
7486,
17,
7,
17,
20,
21,
13,
15,
11,
220,
17,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_borrow_with_not_called_when_filled() {
let lazycell = LazyCell::new();
lazycell.fill(1).unwrap();
let value = lazycell.borrow_with(|| 2);
assert_eq!(&1, value);
} | rust_cleaned_test_functions.jsonl/5794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
7768,
6615,
7913,
27859,
47636,
90592,
368,
341,
286,
1077,
64436,
3337,
613,
284,
44263,
3599,
486,
931,
1428,
286,
64436,
3337,
613,
12467,
7,
16,
568,
15454,
1428,
286,
1077,
897,
284,
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
] | 2 |
#[test]
fn test_parse_nulls() {
use IonType::*;
parse_equals("null ", Null);
parse_equals("null.null ", Null);
parse_equals("null.bool ", Boolean);
parse_equals("null.int ", Integer);
parse_equals("null.float ", Float);
parse_equals("null.decimal ", Decimal);
parse_equals("null.timestamp ", Timestamp);
parse_equals("null.string ", String);
parse_equals("null.symbol ", Symbol);
parse_equals("null.blob ", Blob);
parse_equals("null.clob ", Clob);
parse_equals("null.list ", List);
parse_equals("null.sexp ", SExpression);
parse_equals("null.struct ", Struct);
// Misspelled null
parse_fails("nlul ");
// Unrecognized type
parse_fails("null.strunct ");
// Leading whitespace
parse_fails(" null.strunct ");
// Null is end of current input; might be an incomplete stream
parse_fails("null.struct");
} | rust_cleaned_test_functions.jsonl/84317 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15162,
82,
368,
341,
286,
990,
44805,
929,
56162,
286,
4715,
61664,
445,
2921,
3670,
18084,
317,
286,
4715,
61664,
445,
2921,
59266,
3670,
18084,
317,
286,
4715,
61664,
445,
2921,
28791,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_success_job() {
let jobs: Vec<Job> = read_test_file("job");
let job: Job = jobs
.into_iter()
.find(|job| job.id == JobId::new(4_895_231))
.unwrap();
assert_eq!(job.status, StatusState::Success);
assert_eq!(job.stage, "test");
assert_eq!(job.name, "test:cargo-tarpaulin");
assert_eq!(job.ref_.unwrap(), "master");
assert!(!job.tag);
assert_eq!(job.coverage, Some(36.43));
assert_eq!(job.created_at, datetime((2020, 4, 13), (4, 19, 46, 268)));
assert_eq!(
job.started_at,
Some(datetime((2020, 4, 13), (4, 29, 56, 752)))
);
assert_eq!(
job.finished_at,
Some(datetime((2020, 4, 13), (4, 30, 57, 772)))
);
check_user_buildbot(&job.user.unwrap().into());
let artifacts_file = job.artifacts_file.unwrap();
assert_eq!(artifacts_file.filename, "artifacts.zip");
assert_eq!(artifacts_file.size, 76517);
check_commit_add_job_commands(&job.commit);
let runner = job.runner.unwrap();
assert_eq!(runner.id, RunnerId::new(156));
assert_eq!(runner.description.unwrap(), "minmus.priv-x11");
assert!(runner.active);
assert!(runner.is_shared);
assert_eq!(runner.name.unwrap(), "gitlab-runner");
assert_eq!(job.pipeline.id, PipelineId::new(168_478));
assert_eq!(job.pipeline.ref_.unwrap(), "master");
assert_eq!(
job.pipeline.sha,
ObjectId::new("0028f47612b928d94e5e1a4329f3e74d6fdd7032")
);
assert_eq!(job.pipeline.status, StatusState::Running);
assert_eq!(
job.pipeline.created_at,
Some(datetime((2020, 4, 13), (4, 19, 45, 398)))
);
assert_eq!(
job.pipeline.updated_at,
Some(datetime((2020, 4, 13), (4, 36, 12, 508)))
);
assert_eq!(
job.pipeline.web_url,
"https://gitlab.kitware.com/utils/rust-gitlab/-/pipelines/168478"
);
assert!(!job.allow_failure);
assert_eq!(job.duration, Some(61.019_904));
check_job_artifacts(
&job.artifacts,
&[
JobArtifactRef {
file_type: "archive",
file_format: Some("zip"),
filename: "artifacts.zip",
size: 76517,
},
JobArtifactRef {
file_type: "metadata",
file_format: Some("gzip"),
filename: "metadata.gz",
size: 166,
},
JobArtifactRef {
file_type: "trace",
file_format: None,
filename: "job.log",
size: 12238,
},
],
);
assert_eq!(
job.artifacts_expire_at,
Some(datetime((2020, 4, 20), (4, 30, 57, 46)))
);
assert_eq!(
job.web_url,
"https://gitlab.kitware.com/utils/rust-gitlab/-/jobs/4895231"
);
} | rust_cleaned_test_functions.jsonl/12962 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
18632,
20298,
368,
341,
262,
1077,
6887,
25,
11312,
27,
12245,
29,
284,
1349,
4452,
2458,
445,
8799,
797,
262,
1077,
2618,
25,
12011,
284,
6887,
198,
286,
659,
18122,
11723,
741,
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_mac_addr_serialization_and_deserialization() {
let mac: MacAddr =
serde_json::from_str("\"12:34:56:78:9a:bc\"").expect("MacAddr deserialization failed.");
let bytes = mac.get_bytes();
assert_eq!(bytes, [0x12u8, 0x34, 0x56, 0x78, 0x9a, 0xbc]);
let s = serde_json::to_string(&mac).expect("MacAddr serialization failed.");
assert_eq!(s, "\"12:34:56:78:9a:bc\"");
} | rust_cleaned_test_functions.jsonl/18569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22802,
7387,
25602,
2022,
8378,
15768,
50563,
368,
341,
286,
1077,
8978,
25,
7401,
13986,
4035,
310,
61570,
9455,
486,
1499,
2895,
38915,
16,
17,
25,
18,
19,
25,
20,
21,
25,
22,
23,
25,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_star_network_large_pull() {
solana_logger::setup();
let mut network = star_network_create(2000);
let thread_pool = build_gossip_thread_pool();
network_simulator_pull_only(&thread_pool, &mut network);
} | rust_cleaned_test_functions.jsonl/2401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31681,
20966,
45228,
65693,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
543,
262,
1077,
5206,
3922,
284,
6774,
20966,
8657,
7,
17,
15,
15,
15,
317,
262,
1077,
4516,
15709,
284,
1936,
1889,
414... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_opt_files_dir_dscr_rot() {
let link_name = "link_to_log".to_string();
let handle = Logger::try_with_str("info")
.unwrap()
.format(opt_format)
.log_to_file(
FileSpec::default()
.directory("log_files")
.discriminant("foo".to_string()),
)
.rotate(Criterion::Size(2000), Naming::Numbers, Cleanup::Never)
.create_symlink(link_name.clone())
.start()
.unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));
error!("This is an error message");
warn!("This is a warning");
info!("This is an info message");
debug!("This is a debug message - you must not see it!");
trace!("This is a trace message - you must not see it!");
handle.validate_logs(&[
("ERROR", "test_opt_files_dir_dscr_rot", "error"),
("WARN", "test_opt_files_dir_dscr_rot", "warning"),
("INFO", "test_opt_files_dir_dscr_rot", "info"),
]);
self::platform::check_link(&link_name);
} | rust_cleaned_test_functions.jsonl/6616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 505
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15032,
10931,
4334,
814,
25065,
38256,
368,
972,
262,
1077,
2656,
1269,
284,
330,
2080,
2346,
5224,
3263,
983,
3904,
1647,
262,
1077,
3705,
284,
9514,
486,
1539,
6615,
2895,
445,
2733,
6060,
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_calc_width() {
let width = calc_range_width(0); // +/-10 V
assert_eq!(width, 20.0);
let width = calc_range_width(1); // +/-5 V
assert_eq!(width, 10.0);
let width = calc_range_width(2); // +/-2.5 V
assert_eq!(width, 5.0);
let width = calc_range_width(3); // +/-1.25 V
assert_eq!(width, 2.5);
let width = calc_range_width(4); // 10 V
assert_eq!(width, 10.0);
let width = calc_range_width(5); // 5 V
assert_eq!(width, 5.0);
let width = calc_range_width(6); // 2.5 V
assert_eq!(width, 2.5);
} | rust_cleaned_test_functions.jsonl/62657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38241,
7927,
368,
341,
286,
1077,
2374,
284,
10035,
9698,
7927,
7,
15,
1215,
442,
51615,
16,
15,
647,
198,
286,
2060,
10714,
10297,
3098,
11,
220,
17,
15,
13,
15,
626,
286,
1077,
2374,
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_if_expression() {
let exp = statement_expression("if (x < y) { x }");
let (cond, stmts) = match exp {
Expression::If {
condition,
consequence,
alternative: None,
..
} => {
let statements = match *consequence {
Statement::Block { statements, .. } => statements,
_ => panic!("Expected block"),
};
(condition, statements)
}
_ => panic!("Expected if"),
};
verify_infix_ident(*cond, "x", "<", "y");
assert_eq!(1, stmts.len());
match &stmts[0] {
Statement::Expression {
value: Expression::Identifier(Identifier { value, .. }),
..
} => assert_eq!("x", value),
_ => panic!("Expected identifier"),
}
} | rust_cleaned_test_functions.jsonl/64080 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 519
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
28068,
368,
341,
286,
1077,
1343,
284,
5114,
28068,
445,
333,
320,
87,
366,
379,
8,
314,
856,
335,
797,
286,
1077,
320,
1297,
11,
20020,
82,
8,
284,
2432,
1343,
341,
310,
16378,
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... | 4 |
#[test]
fn test_diff_trees() {
setup();
let from_tree = Tree::new(".", &[]).unwrap();
let f_oid = Tree::write_tree(".", &[]).unwrap();
// This diff pattern: a removed file and two new files.
fs::remove_file("./cat.txt").unwrap();
fs::write("./dragon.txt", "Ryuu").unwrap();
fs::write("./tiger.txt", "ToraTora").unwrap();
let to_tree = Tree::new(".", &[]).unwrap();
let mut diffs = diff_trees(from_tree, to_tree, false).unwrap();
diffs.1.sort();
if cfg!(target_os = "windows") {
assert!(diffs.0.len() == 0);
assert_eq!(diffs.1, vec![".\\dragon.txt", ".\\tiger.txt"]);
assert_eq!(diffs.2, vec![".\\cat.txt"]);
} else {
assert!(diffs.0.len() == 0);
assert_eq!(diffs.1, vec!["./dragon.txt", "./tiger.txt"]);
assert_eq!(diffs.2, vec!["./cat.txt"]);
}
// This diff pattern: a update file.
let from_tree = Tree::new(".", &[]).unwrap();
let mut f = fs::OpenOptions::new()
.write(true)
.truncate(true)
.open("./tiger.txt")
.unwrap();
f.write_all(b"gaoo").unwrap();
f.flush().unwrap();
let to_tree = Tree::new(".", &[]).unwrap();
let diffs = diff_trees(from_tree, to_tree, false).unwrap();
if cfg!(target_os = "windows") {
assert_eq!(diffs.0, vec![".\\tiger.txt"]);
assert!(diffs.1.len() == 0);
assert!(diffs.2.len() == 0);
} else {
assert_eq!(diffs.0, vec!["./tiger.txt"]);
assert!(diffs.1.len() == 0);
assert!(diffs.2.len() == 0);
}
Tree::read_tree(&f_oid, &[]).unwrap();
} | rust_cleaned_test_functions.jsonl/70348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 783
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
75791,
368,
341,
262,
6505,
543,
262,
1077,
504,
11663,
284,
8942,
486,
931,
64217,
609,
1294,
568,
15454,
543,
262,
1077,
282,
59633,
284,
8942,
486,
4934,
11663,
64217,
609,
1294,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_progress_is_paused() {
let tests = vec![
(ProgressState::Probe, false, false),
(ProgressState::Probe, true, true),
(ProgressState::Replicate, false, false),
(ProgressState::Replicate, true, false),
(ProgressState::Snapshot, false, true),
(ProgressState::Snapshot, true, true),
];
for (i, &(state, paused, w)) in tests.iter().enumerate() {
let mut p = new_progress(state, 0, 0, 0, 256);
p.paused = paused;
if p.is_paused() != w {
panic!("#{}: shouldwait = {}, want {}", i, p.is_paused(), w)
}
}
} | rust_cleaned_test_functions.jsonl/30238 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27200,
6892,
55475,
2591,
368,
341,
262,
1077,
7032,
284,
7486,
90515,
286,
320,
9496,
1397,
486,
81426,
11,
895,
11,
895,
1326,
286,
320,
9496,
1397,
486,
81426,
11,
830,
11,
830,
1326,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_ping() {
let provider = CoreProvider {
wire_protocol_version_min: 8,
wire_protocol_version_maj: 10,
provider_info: Vec::new(),
provider_opcodes: HashMap::new(),
prov_list: Vec::new(),
};
let op = ping::Operation {};
let result = provider.ping(op).unwrap();
assert_eq!(
result.wire_protocol_version_maj,
provider.wire_protocol_version_maj
);
assert_eq!(
result.wire_protocol_version_min,
provider.wire_protocol_version_min
);
} | rust_cleaned_test_functions.jsonl/13776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71661,
368,
341,
286,
1077,
9109,
284,
9518,
5179,
341,
310,
9067,
34880,
9438,
7260,
25,
220,
23,
345,
310,
9067,
34880,
9438,
717,
1630,
25,
220,
16,
15,
345,
310,
9109,
3109,
25,
11312,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize() -> Result<(), Box<dyn Error>> {
let i18n = crate::data_types::I18n {
id: 123,
value: HashMap::<String, String>::from_iter(IntoIter::new([
("zh-CN".into(), "中文".into()),
("en-US".into(), "English".into()),
])),
};
let ret = serde_json::to_string(&i18n)?;
match ret.as_str() {
r#"{"zh-CN":"中文","en-US":"English"}"# => Ok(()),
r#"{"en-US":"English","zh-CN":"中文"}"# => Ok(()),
_ => Err(ret.into()),
}
} | rust_cleaned_test_functions.jsonl/62746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
600,
16,
23,
77,
284,
17717,
486,
691,
9763,
486,
40,
16,
23,
77,
341,
310,
877,
25,
220,
16,
17,
18,
345,
310,
897,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_example() {
let data = parse(EXEMPLE);
assert_eq!(part1(&data), format!("solution {}",1656));
assert_eq!(part2(&data), format!("solution {}",195));
} | rust_cleaned_test_functions.jsonl/43115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
368,
341,
286,
1077,
821,
284,
220,
4715,
25409,
2716,
9515,
317,
286,
2060,
10714,
10297,
4480,
16,
2099,
691,
701,
3561,
17223,
49460,
24689,
16,
21,
20,
21,
1106,
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,
1,
1
] | 1 |
#[test]
fn test_parse_data() {
let s = [0x00, 0x03, 0x00, 0x01, 0x68, 0x65, 0x6c, 0x6c, 0x6f];
let data = Data::parse(&s).unwrap();
assert_eq!(data.block(), 1);
assert_eq!(data.data(), &s[4..]);
} | rust_cleaned_test_functions.jsonl/104032 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1769,
368,
341,
286,
1077,
274,
284,
508,
15,
87,
15,
15,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
21,
23,
11,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fixup_relative_calls_out_of_bounds_forward() {
let mut calls: HashMap<u32, usize> = HashMap::new();
// call +5
#[rustfmt::skip]
let mut prog = vec![
0x85, 0x10, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0xb7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
ElfExecutable::fixup_relative_calls(&mut calls, &mut prog).unwrap();
let key = ebpf::hash_symbol_name(&[0]);
let insn = ebpf::Insn {
opc: 0x85,
dst: 0,
src: 1,
off: 0,
imm: key as i32,
};
assert_eq!(insn.to_array(), prog[..8]);
assert_eq!(*calls.get(&key).unwrap(), 1);
} | rust_cleaned_test_functions.jsonl/55866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 590
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36060,
454,
29286,
45636,
6068,
3575,
36878,
32121,
368,
341,
286,
1077,
5206,
6738,
25,
10528,
34837,
18,
17,
11,
22301,
29,
284,
10528,
486,
931,
543,
286,
442,
1618,
488,
20,
198,
286,
11506,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_known_script_too_large_args() {
let (config, keypair) = get_test_config();
let vm_validator = TestValidator::new(&config);
let address = account_config::association_address();
let txn = transaction_test_helpers::get_test_signed_transaction(
address,
0,
keypair.private_key().clone(),
keypair.public_key(),
Some(Program::new(
vec![42; MAX_TRANSACTION_SIZE_IN_BYTES],
vec![],
vec![],
)), /* generate a program with args longer than the max size */
0,
0, /* max gas price */
None,
);
let txn = SignedTransaction::from_proto(txn).unwrap();
let ret = vm_validator.validate_transaction(txn).wait().unwrap();
assert_matches!(
ret,
Some(VMStatus::Validation(VMValidationStatus::ExceededMaxTransactionSize(_)))
);
} | rust_cleaned_test_functions.jsonl/90959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
71690,
14660,
2346,
78,
45228,
8384,
368,
341,
262,
1077,
320,
1676,
11,
1376,
12670,
8,
284,
633,
4452,
5332,
543,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
2099,
1676,
626,
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_send_msg_for_success() {
let a_0 = agent::ZeroAgent::new("tcp://127.0.0.1:8787".to_string());
let th0 = a_0.activate();
let a_1 = agent::ZeroAgent::new("tcp://127.0.0.1:8989".to_string());
let th1 = a_1.activate();
a_1.add_peer("tcp://127.0.0.1:8787".to_string());
thread::sleep(time::Duration::from_millis(2 * agent::WAIT));
a_1.send_msg(
"tcp://127.0.0.1:8787",
&agent::Msg::Message(String::from("hello")),
);
send_kill("tcp://127.0.0.1:8787");
send_kill("tcp://127.0.0.1:8989");
th0.0.join().unwrap();
th0.1.join().unwrap();
th1.0.join().unwrap();
th1.1.join().unwrap();
} | rust_cleaned_test_functions.jsonl/104675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
6483,
5478,
18632,
368,
341,
286,
1077,
264,
62,
15,
284,
8315,
486,
17999,
16810,
486,
931,
445,
27161,
1110,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
23,
22,
23,
22,
3263,
983,
390... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let mut m = HashMap::new();
m.insert(1, 2);
assert_eq!(m.remove(&1), Some(2));
assert_eq!(m.remove(&1), None);
} | rust_cleaned_test_functions.jsonl/8508 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
368,
341,
286,
1077,
5206,
296,
284,
10528,
486,
931,
543,
286,
296,
7030,
7,
16,
11,
220,
17,
317,
286,
2060,
10714,
10297,
76,
4850,
2099,
16,
701,
4329,
7,
17,
1106,
286,
2060,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_box() {
let anyof: Box<AnyOf<MyTrait>> = Box::new(AnyOf::new(MyStruct1(1i32)));
assert_eq!(anyof.get(), 1i32);
assert_eq!(anyof.downcast_ref::<MyStruct1>(), Some(&MyStruct1(1i32)));
assert_eq!(anyof.downcast_ref::<MyStruct2>(), None);
let anyof: Box<AnyOf<MyTrait>> = Box::new(AnyOf::new(MyStruct2(1i32)));
assert_eq!(anyof.get(), 2i32);
assert_eq!(anyof.downcast_ref::<MyStruct1>(), None);
assert_eq!(anyof.downcast_ref::<MyStruct2>(), Some(&MyStruct2(1i32)));
} | rust_cleaned_test_functions.jsonl/66297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10194,
368,
341,
286,
1077,
894,
1055,
25,
8261,
86712,
2124,
79333,
49257,
2452,
284,
8261,
486,
931,
7,
8610,
2124,
486,
931,
37485,
9422,
16,
7,
16,
72,
18,
17,
4945,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builder_i32_grow_buffer() {
let mut b = BufferBuilder::<i32>::new(2);
assert_eq!(16, b.capacity());
for i in 0..20 {
b.push(i).unwrap();
}
assert_eq!(32, b.capacity());
let a = b.finish();
assert_eq!(80, a.len());
} | rust_cleaned_test_functions.jsonl/127617 | {
"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,
28532,
5318,
18,
17,
1889,
651,
7776,
368,
341,
286,
1077,
5206,
293,
284,
10312,
3297,
27638,
72,
18,
17,
6831,
931,
7,
17,
317,
286,
2060,
10714,
10297,
16,
21,
11,
293,
59168,
1423,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_issue_506() {
let hdr = indoc! {"
namespace std {
template <class, class> class am;
typedef am<char, char> an;
} // namespace std
namespace be {
class bf {
virtual std::an bg() = 0;
};
class bh : bf {};
} // namespace be
namespace spanner {
class Database;
class Row {
public:
Row(be::bh *);
};
} // namespace spanner
"};
let rs = quote! {};
run_test("", hdr, rs, &["spanner::Database", "spanner::Row"], &[]);
} | rust_cleaned_test_functions.jsonl/9900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53340,
62,
20,
15,
21,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
4473,
1460,
341,
310,
3811,
366,
1040,
11,
536,
29,
536,
1079,
280,
310,
13501,
1079,
21919,
11,
1161,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_apply()
{
let z = crate::cmatrix::COMPLEX_ZERO;
let o = crate::cmatrix::COMPLEX_ONE;
let x = crate::cmatrix::COMPLEX_HSQRT2;
let h = o * 0.5;
let mut state = array![
[o, z, h, z],
[z, z, -h, z],
[z, o, h, x],
[z, z, -h, -x]
];
let result = array![
[x, z, z, z],
[x, z, x, z],
[z, x, z, z],
[z, x, x, o]
];
gate_test(Kron::new(I::new(), H::new()), &mut state, &result);
let mut state = array![
[o, z, h, z],
[z, z, -h, z],
[z, o, h, x],
[z, z, -h, -x]
];
let result = array![
[x, x, x, h],
[z, z, -x, -h],
[x, -x, z, -h],
[z, z, z, h]
];
gate_test(Kron::new(H::new(), I::new()), &mut state, &result);
let mut state = array![
[o, z, h, z],
[z, z, -h, z],
[z, o, h, x],
[z, z, -h, -x]
];
let result = array![
[h, h, z, z],
[h, h, o, x],
[h, -h, z, z],
[h, -h, z, -x]
];
gate_test(Kron::new(H::new(), H::new()), &mut state, &result);
} | rust_cleaned_test_functions.jsonl/34667 | {
"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,
36551,
741,
262,
341,
286,
1077,
1147,
284,
17717,
486,
6226,
2555,
486,
8696,
42136,
39370,
280,
286,
1077,
297,
284,
17717,
486,
6226,
2555,
486,
8696,
42136,
34727,
280,
286,
1077,
856,
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_cast_list_i32_to_list_u16() {
// Construct a value array
let value_data = Int32Array::from(vec![0, 0, 0, -1, -2, -1, 2, 100000000]).data();
let value_offsets = Buffer::from(&[0, 3, 6, 8].to_byte_slice());
// Construct a list array from the above two
let list_data_type = DataType::List(Box::new(DataType::Int32));
let list_data = ArrayData::builder(list_data_type)
.len(3)
.add_buffer(value_offsets)
.add_child_data(value_data)
.build();
let list_array = Arc::new(ListArray::from(list_data)) as ArrayRef;
let cast_array =
cast(&list_array, &DataType::List(Box::new(DataType::UInt16))).unwrap();
// 1 value should overflow
assert_eq!(4, cast_array.null_count());
// offsets should be the same
assert_eq!(
list_array.data().buffers().to_vec(),
cast_array.data().buffers().to_vec()
);
let array = cast_array
.as_ref()
.as_any()
.downcast_ref::<ListArray>()
.unwrap();
assert_eq!(DataType::UInt16, array.value_type());
assert_eq!(4, array.values().null_count());
assert_eq!(3, array.value_length(0));
assert_eq!(3, array.value_length(1));
assert_eq!(2, array.value_length(2));
let values = array.values();
let u16arr = values.as_any().downcast_ref::<UInt16Array>().unwrap();
assert_eq!(8, u16arr.len());
assert_eq!(4, u16arr.null_count());
assert_eq!(0, u16arr.value(0));
assert_eq!(0, u16arr.value(1));
assert_eq!(0, u16arr.value(2));
assert_eq!(false, u16arr.is_valid(3));
assert_eq!(false, u16arr.is_valid(4));
assert_eq!(false, u16arr.is_valid(5));
assert_eq!(2, u16arr.value(6));
assert_eq!(false, u16arr.is_valid(7));
} | rust_cleaned_test_functions.jsonl/29610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 975
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
2019,
5318,
18,
17,
2346,
2019,
7300,
16,
21,
368,
341,
286,
442,
18678,
264,
897,
1334,
198,
286,
1077,
897,
1769,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
15,
11,
220,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_opalkelly_xem_7010_synth_pipe_afifo() {
let mut uut = OpalKellyPipeAFIFOTest::new::<XEM7010>();
uut.hi.link_connect_dest();
uut.fast_clock.connect();
uut.connect_all();
XEM7010::synth(uut, target_path!("xem_7010/pipe_afifo"));
test_opalkelly_pipe_afifo_runtime(target_path!("xem_7010/pipe_afifo/top.bit")).unwrap()
} | rust_cleaned_test_functions.jsonl/122977 | {
"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,
10287,
1692,
11896,
3212,
336,
62,
22,
15,
16,
15,
643,
45809,
41862,
67213,
31497,
368,
341,
262,
1077,
5206,
575,
332,
284,
10672,
278,
69072,
34077,
8276,
2773,
1793,
477,
486,
931,
27638,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_for_vec_attr_slice_shadowing() {
let t = ForVecAttrSliceShadowingTemplate {
v: vec![
ForVecAttrSlice { iterable: &[1, 2] },
ForVecAttrSlice { iterable: &[3, 4] },
ForVecAttrSlice { iterable: &[5, 6] },
],
};
assert_eq!(t.render().unwrap(), "1 2 3 4 5 6 ");
} | rust_cleaned_test_functions.jsonl/24301 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
13251,
10422,
26488,
53120,
287,
368,
341,
262,
1077,
259,
284,
1752,
10050,
13371,
33236,
23667,
287,
7275,
341,
286,
348,
25,
7486,
90515,
310,
1752,
10050,
13371,
33236,
314,
50834,
25,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transpile() {
let specifier = resolve_url_or_path("https://deno.land/x/mod.ts")
.expect("could not resolve specifier");
let source = r#"
enum D {
A,
B,
C,
}
export class A {
private b: string;
protected c: number = 1;
e: "foo";
constructor (public d = D.A) {
const e = "foo" as const;
this.e = e;
}
}
"#;
let module = parse_module(ParseParams {
specifier: specifier.as_str().to_string(),
source: SourceTextInfo::from_string(source.to_string()),
media_type: deno_ast::MediaType::TypeScript,
capture_tokens: false,
maybe_syntax: None,
scope_analysis: false,
})
.expect("could not parse module");
let (code, maybe_map) = transpile(&module, &EmitOptions::default())
.expect("could not strip types");
assert!(code.starts_with("var D;\n(function(D) {\n"));
assert!(
code.contains("\n//# sourceMappingURL=data:application/json;base64,")
);
assert!(maybe_map.is_none());
} | rust_cleaned_test_functions.jsonl/65182 | {
"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,
7965,
12192,
368,
341,
262,
1077,
97616,
284,
8830,
2903,
8734,
2638,
445,
2428,
1110,
5183,
78,
87627,
10776,
38479,
21288,
1138,
414,
659,
17119,
445,
28077,
537,
8830,
97616,
797,
262,
1077,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_multi() -> Result<(), Box<dyn error::Error>> {
let content = fs::read_to_string(PathBuf::new().join("tests/files/simple.go"))?;
let str = content
.lines()
.skip(10)
.take(4)
.collect::<Vec<_>>()
.join("\r\n");
assert_eq!(
TypeDecl {
type_specs: vec![
TypeSpec::TypeDef(TypeDef {
name: "Point".to_owned(),
r#type: Type::StructType(StructType {
field_decls: vec![FieldDecl {
struct_field: StructField::IdentifierListType(
vec!["x".to_owned(), "y".to_owned()],
Type::TypeName(TypeName::Float64).into(),
),
tag: None,
},]
})
}),
TypeSpec::TypeDef(TypeDef {
name: "polar".to_owned(),
r#type: Type::TypeName(TypeName::Identifier("Point".to_owned())),
})
]
},
str.parse()?
);
Ok(())
} | rust_cleaned_test_functions.jsonl/129653 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 727
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25133,
368,
1464,
5714,
68843,
8261,
92846,
1465,
486,
1454,
2452,
341,
262,
1077,
2213,
284,
8619,
486,
878,
2346,
3904,
33030,
15064,
486,
931,
1005,
5987,
445,
23841,
33220,
67195,
18002,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_order_monotonic() {
let dt = Utc::now();
let mut gen = Generator::new();
let ulid1 = gen.generate_from_datetime(dt).unwrap();
let ulid2 = gen.generate_from_datetime(dt).unwrap();
let ulid3 = Ulid::from_datetime(dt + Duration::milliseconds(1));
assert_eq!(ulid1.0 + 1, ulid2.0);
assert!(ulid2 < ulid3);
assert!(ulid2.timestamp_ms() < ulid3.timestamp_ms())
} | rust_cleaned_test_functions.jsonl/105731 | {
"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,
7869,
20737,
354,
14011,
368,
341,
286,
1077,
7594,
284,
547,
10413,
486,
3328,
543,
286,
1077,
5206,
4081,
284,
28358,
486,
931,
543,
286,
1077,
8557,
307,
16,
284,
4081,
22019,
5673,
28943,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_valid_types_one_of() -> Result<()> {
let signature =
TypeSignature::OneOf(vec![TypeSignature::Any(1), TypeSignature::Any(2)]);
let invalid_types = get_valid_types(
&signature,
&[DataType::Int32, DataType::Int32, DataType::Int32],
)?;
assert_eq!(invalid_types.len(), 0);
let args = vec![DataType::Int32, DataType::Int32];
let valid_types = get_valid_types(&signature, &args)?;
assert_eq!(valid_types.len(), 1);
assert_eq!(valid_types[0], args);
let args = vec![DataType::Int32];
let valid_types = get_valid_types(&signature, &args)?;
assert_eq!(valid_types.len(), 1);
assert_eq!(valid_types[0], args);
Ok(())
} | rust_cleaned_test_functions.jsonl/47385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8337,
9763,
11667,
3575,
368,
1464,
5714,
71698,
341,
286,
1077,
11957,
4035,
310,
3990,
25088,
486,
3966,
2124,
25592,
20703,
929,
25088,
486,
8610,
7,
16,
701,
3990,
25088,
486,
8610,
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... | 4 |
#[test]
fn test_flexible_plaintext_add_plaintext() {
let t = 199;
let fv = crate::default_with_plaintext_mod(t);
let (pk, sk) = fv.generate_keypair();
let plain_modulus = fv.t.clone();
let v = vec![Scalar::from_u32(t - 1, &plain_modulus); fv.n];
let w = vec![Scalar::from_u32(1, &plain_modulus); fv.n];
let v_plus_w = vec![Scalar::from_u32(0, &plain_modulus); fv.n];
let mut ct = fv.encrypt(&v, &pk);
fv.add_plain_inplace(&mut ct, &w);
let pt_actual: Vec<Scalar> = fv.decrypt(&ct, &sk);
assert_eq!(pt_actual, v_plus_w);
} | rust_cleaned_test_functions.jsonl/103696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
94544,
6317,
1641,
427,
2891,
6317,
1641,
427,
368,
341,
286,
1077,
259,
284,
220,
16,
24,
24,
280,
286,
1077,
61654,
284,
17717,
486,
2258,
6615,
6317,
1641,
427,
7480,
1155,
317,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_module_code_action_in_json_project() {
if skip_slow_tests() {
return;
}
let tmp_dir = TestDir::new();
let path = tmp_dir.path();
let project = json!({
"roots": [path],
"crates": [ {
"root_module": path.join("src/lib.rs"),
"deps": [],
"edition": "2015",
"cfg": [ "cfg_atom_1", "feature=\"cfg_1\""],
} ]
});
let code = format!(
r#"
//- /rust-project.json
{PROJECT}
//- /src/lib.rs
mod bar;
fn main() {{}}
"#,
PROJECT = project.to_string(),
);
let server =
Project::with_fixture(&code).tmp_dir(tmp_dir).server().wait_until_workspace_is_loaded();
server.request::<CodeActionRequest>(
CodeActionParams {
text_document: server.doc_id("src/lib.rs"),
range: Range::new(Position::new(0, 4), Position::new(0, 7)),
context: CodeActionContext::default(),
partial_result_params: PartialResultParams::default(),
work_done_progress_params: WorkDoneProgressParams::default(),
},
json!([{
"edit": {
"documentChanges": [
{
"kind": "create",
"uri": "file://[..]/src/bar.rs"
}
]
},
"isPreferred": false,
"kind": "quickfix",
"title": "Create module"
}]),
);
server.request::<CodeActionRequest>(
CodeActionParams {
text_document: server.doc_id("src/lib.rs"),
range: Range::new(Position::new(2, 4), Position::new(2, 7)),
context: CodeActionContext::default(),
partial_result_params: PartialResultParams::default(),
work_done_progress_params: WorkDoneProgressParams::default(),
},
json!([]),
);
} | rust_cleaned_test_functions.jsonl/27497 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 956
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
10750,
4136,
7931,
1243,
9455,
16352,
368,
341,
262,
421,
10706,
82447,
32509,
368,
341,
286,
470,
280,
262,
555,
262,
1077,
4174,
4334,
284,
3393,
6184,
486,
931,
1428,
262,
1077,
1815,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_attach_boot_timer_device() {
let mut vmm = default_vmm();
let request_ts = TimestampUs::default();
let res = attach_boot_timer_device(&mut vmm, request_ts);
assert!(res.is_ok());
assert!(vmm
.mmio_device_manager
.get_device(DeviceType::BootTimer, &DeviceType::BootTimer.to_string())
.is_some());
} | rust_cleaned_test_functions.jsonl/4355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40719,
52062,
16255,
9204,
368,
341,
286,
1077,
5206,
348,
3821,
284,
1638,
2273,
3821,
543,
286,
1077,
1681,
25023,
284,
32758,
3558,
486,
2258,
1428,
286,
1077,
592,
284,
15498,
52062,
16255,
92... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_notify_account_restore_from_snapshot_once_per_slot() {
let mut accounts = AccountsDb::new_single_for_tests();
// Account with key1 is updated twice in the store -- should only get notified once.
let key1 = solana_sdk::pubkey::new_rand();
let mut account1_lamports: u64 = 1;
let account1 =
AccountSharedData::new(account1_lamports, 1, AccountSharedData::default().owner());
let slot0 = 0;
accounts.store_uncached(slot0, &[(&key1, &account1)]);
account1_lamports = 2;
let account1 = AccountSharedData::new(account1_lamports, 1, account1.owner());
accounts.store_uncached(slot0, &[(&key1, &account1)]);
let notifier = GeyserTestPlugin::default();
let key2 = solana_sdk::pubkey::new_rand();
let account2_lamports: u64 = 100;
let account2 =
AccountSharedData::new(account2_lamports, 1, AccountSharedData::default().owner());
accounts.store_uncached(slot0, &[(&key2, &account2)]);
let notifier = Arc::new(RwLock::new(notifier));
accounts.set_geyser_plugin_notifer(Some(notifier.clone()));
accounts.notify_account_restore_from_snapshot();
let notifier = notifier.write().unwrap();
assert_eq!(notifier.accounts_notified.get(&key1).unwrap().len(), 1);
assert_eq!(
notifier.accounts_notified.get(&key1).unwrap()[0]
.1
.lamports(),
account1_lamports
);
assert_eq!(notifier.accounts_notified.get(&key1).unwrap()[0].0, slot0);
assert_eq!(notifier.accounts_notified.get(&key2).unwrap().len(), 1);
assert_eq!(
notifier.accounts_notified.get(&key2).unwrap()[0]
.1
.lamports(),
account2_lamports
);
assert_eq!(notifier.accounts_notified.get(&key2).unwrap()[0].0, slot0);
assert!(notifier.is_startup_done.load(Ordering::Relaxed));
} | rust_cleaned_test_functions.jsonl/46210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 933
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36654,
13500,
62677,
5673,
53265,
7630,
5678,
27563,
368,
341,
286,
1077,
5206,
9618,
284,
40655,
7994,
486,
931,
19487,
5478,
32509,
543,
286,
442,
8615,
448,
1376,
16,
374,
6049,
10917,
304,
279... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_dynamic_offers_specify_target() {
assert_eq!(
validate_dynamic_offers(&vec![
fdecl::Offer::Protocol(fdecl::OfferProtocol {
dependency_type: Some(fdecl::DependencyType::Strong),
source: Some(fdecl::Ref::Self_(fdecl::SelfRef)),
target: Some(fdecl::Ref::Child(fdecl::ChildRef {
name: "foo".to_string(),
collection: None
})),
source_name: Some("thing".to_string()),
target_name: Some("thing".to_string()),
..fdecl::OfferProtocol::EMPTY
}),
fdecl::Offer::Service(fdecl::OfferService {
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
target: Some(fdecl::Ref::Child(fdecl::ChildRef {
name: "bar".to_string(),
collection: Some("baz".to_string())
})),
source_name: Some("thang".to_string()),
target_name: Some("thang".to_string()),
..fdecl::OfferService::EMPTY
}),
fdecl::Offer::Directory(fdecl::OfferDirectory {
dependency_type: Some(fdecl::DependencyType::Strong),
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
target: Some(fdecl::Ref::Framework(fdecl::FrameworkRef)),
source_name: Some("thung1".to_string()),
target_name: Some("thung1".to_string()),
..fdecl::OfferDirectory::EMPTY
}),
fdecl::Offer::Storage(fdecl::OfferStorage {
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
target: Some(fdecl::Ref::Child(fdecl::ChildRef {
name: "bar".to_string(),
collection: Some("baz".to_string())
})),
source_name: Some("thung2".to_string()),
target_name: Some("thung2".to_string()),
..fdecl::OfferStorage::EMPTY
}),
fdecl::Offer::Runner(fdecl::OfferRunner {
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
target: Some(fdecl::Ref::Child(fdecl::ChildRef {
name: "bar".to_string(),
collection: Some("baz".to_string())
})),
source_name: Some("thung3".to_string()),
target_name: Some("thung3".to_string()),
..fdecl::OfferRunner::EMPTY
}),
fdecl::Offer::Resolver(fdecl::OfferResolver {
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
target: Some(fdecl::Ref::Child(fdecl::ChildRef {
name: "bar".to_string(),
collection: Some("baz".to_string())
})),
source_name: Some("thung4".to_string()),
target_name: Some("thung4".to_string()),
..fdecl::OfferResolver::EMPTY
}),
fdecl::Offer::Event(fdecl::OfferEvent {
target: Some(fdecl::Ref::Child(fdecl::ChildRef {
name: "bar".to_string(),
collection: Some("baz".to_string())
})),
source: Some(fdecl::Ref::Parent(fdecl::ParentRef)),
source_name: Some("thung5".to_string()),
target_name: Some("thung5".to_string()),
mode: Some(fdecl::EventMode::Async),
..fdecl::OfferEvent::EMPTY
}),
]),
Err(ErrorList::new(vec![
Error::extraneous_field("OfferProtocol", "target"),
Error::extraneous_field("OfferService", "target"),
Error::extraneous_field("OfferDirectory", "target"),
Error::extraneous_field("OfferStorage", "target"),
Error::extraneous_field("OfferRunner", "target"),
Error::extraneous_field("OfferResolver", "target"),
Error::extraneous_field("OfferEvent", "target"),
]))
);
} | rust_cleaned_test_functions.jsonl/82027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2547
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
45992,
13651,
388,
13594,
1437,
11123,
368,
341,
286,
2060,
10714,
33673,
310,
9593,
45992,
13651,
388,
2099,
4083,
90515,
394,
282,
10005,
486,
39462,
486,
20689,
955,
10005,
486,
39462,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checksum() {
let test_path1: &'static Path = Path::new("some_path_for_test");
let test_path2: &'static Path = Path::new("other_test_path");
let tempdir = TempDir::new().unwrap();
let tempdir_path = PathBuf::from(tempdir.path());
let mmap_directory = MmapDirectory::open(&tempdir_path).unwrap();
let mut managed_directory = ManagedDirectory::wrap(mmap_directory).unwrap();
let mut write = managed_directory.open_write(test_path1).unwrap();
write.write_all(&[0u8, 1u8]).unwrap();
write.terminate().unwrap();
let mut write = managed_directory.open_write(test_path2).unwrap();
write.write_all(&[3u8, 4u8, 5u8]).unwrap();
write.terminate().unwrap();
assert!(managed_directory.list_damaged().unwrap().is_empty());
let mut corrupted_path = tempdir_path.clone();
corrupted_path.push(test_path2);
let mut file = OpenOptions::new()
.write(true)
.open(&corrupted_path)
.unwrap();
file.write_all(&[255u8]).unwrap();
file.flush().unwrap();
drop(file);
let damaged = managed_directory.list_damaged().unwrap();
assert_eq!(damaged.len(), 1);
assert!(damaged.contains(test_path2));
} | rust_cleaned_test_functions.jsonl/745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 579
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64038,
368,
341,
286,
1077,
1273,
2638,
16,
25,
30136,
1978,
7933,
284,
7933,
486,
931,
445,
14689,
2638,
5478,
4452,
797,
286,
1077,
1273,
2638,
17,
25,
30136,
1978,
7933,
284,
7933,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_fsanitize_blacklist() {
let args = ovec![
"-c",
"foo.c",
"-o",
"foo.o",
"-fsanitize-blacklist=list.txt"
];
let ParsedArguments {
common_args,
extra_hash_files,
..
} = match parse_arguments(args) {
CompilerArguments::Ok(args) => args,
o => panic!("Got unexpected parse result: {:?}", o),
};
assert_eq!(ovec!["-fsanitize-blacklist=list.txt"], common_args);
assert_eq!(
ovec![std::env::current_dir().unwrap().join("list.txt")],
extra_hash_files
);
} | rust_cleaned_test_functions.jsonl/24597 | {
"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,
21039,
761,
65704,
40272,
1607,
368,
341,
286,
1077,
2827,
284,
297,
4083,
90515,
310,
6523,
66,
756,
310,
330,
7975,
520,
756,
310,
6523,
78,
756,
310,
330,
7975,
14439,
756,
310,
6523,
3848,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.