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_set_height() {
let mut pane = gen_pane!(OpenOptions::new().write(true).open("/dev/null").unwrap());
let width: u16 = 1;
let height: u16 = 10;
pane.replace_termsize_getter(Box::new(TestTerminal::new(width, height)));
assert_eq!(pane.set_height(5).unwrap(), 5);
assert_eq!(pane.pane_size().unwrap(), (1, 5));
assert_eq!(pane.set_height(0).unwrap(), 1);
assert_eq!(pane.pane_size().unwrap(), (1, 1));
assert_eq!(
pane.set_height(height).unwrap(),
height - Pane::MESSAGE_BAR_HEIGHT
);
assert_eq!(
pane.pane_size().unwrap(),
(1, height - Pane::MESSAGE_BAR_HEIGHT)
);
assert_eq!(
pane.set_height(height + 1).unwrap(),
height - Pane::MESSAGE_BAR_HEIGHT
);
assert_eq!(
pane.pane_size().unwrap(),
(1, height - Pane::MESSAGE_BAR_HEIGHT)
);
assert_eq!(pane.set_height(5).unwrap(), 5);
assert_eq!(pane.pane_size().unwrap(), (1, 5));
assert_eq!(pane.decrement_height(1).unwrap(), 4);
assert_eq!(pane.pane_size().unwrap(), (1, 4));
assert_eq!(pane.decrement_height(3).unwrap(), 1);
assert_eq!(pane.pane_size().unwrap(), (1, 1));
assert_eq!(pane.decrement_height(100).unwrap(), 1);
assert_eq!(pane.pane_size().unwrap(), (1, 1));
assert_eq!(pane.set_height(5).unwrap(), 5);
assert_eq!(pane.pane_size().unwrap(), (1, 5));
assert_eq!(pane.increment_height(1).unwrap(), 6);
assert_eq!(pane.pane_size().unwrap(), (1, 6));
assert_eq!(pane.increment_height(3).unwrap(), 9);
assert_eq!(pane.pane_size().unwrap(), (1, 9));
assert_eq!(
pane.increment_height(100).unwrap(),
height - Pane::MESSAGE_BAR_HEIGHT
);
assert_eq!(
pane.pane_size().unwrap(),
(1, height - Pane::MESSAGE_BAR_HEIGHT)
);
} | rust_cleaned_test_functions.jsonl/1682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1082
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
9561,
368,
341,
286,
1077,
5206,
37322,
284,
4081,
620,
2145,
10297,
5002,
3798,
486,
931,
1005,
4934,
3715,
568,
2508,
4283,
3583,
19293,
1827,
15454,
1423,
286,
1077,
2374,
25,
575,
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_month_enum_succ_pred() {
assert_eq!(Month::January.succ(), Month::February);
assert_eq!(Month::December.succ(), Month::January);
assert_eq!(Month::January.pred(), Month::December);
assert_eq!(Month::February.pred(), Month::January);
} | rust_cleaned_test_functions.jsonl/92410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18933,
31054,
70758,
12830,
368,
341,
262,
2060,
10714,
10297,
11318,
486,
32227,
514,
14570,
1507,
19397,
486,
32777,
317,
262,
2060,
10714,
10297,
11318,
486,
32146,
514,
14570,
1507,
19397,
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_override() {
err(
"@open class A { fun f() {} } class B extends A { @override fun f() {} }",
pos(1, 60),
SemError::MethodNotOverridable("f".into()),
);
ok("@open class A { @open fun f() {} } class B extends A { @override fun f() {} }");
ok("@open class A { @open fun f() {} }
@open class B extends A { @override fun f() {} }
@open class C extends B { @override fun f() {} }");
err(
"@open class A { @open fun f() {} } class B extends A { fun f() {} }",
pos(1, 56),
SemError::MissingOverride("f".into()),
);
err(
"@open class A { @open fun f() {} }
@open class B extends A { @final @override fun f() {} }
class C extends B { @override fun f() {} }",
pos(3, 44),
SemError::MethodNotOverridable("f".into()),
);
} | rust_cleaned_test_functions.jsonl/128697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48576,
368,
341,
286,
1848,
1006,
310,
8428,
2508,
536,
362,
314,
2464,
282,
368,
4687,
335,
536,
425,
2239,
362,
314,
569,
9199,
2464,
282,
368,
4687,
335,
756,
310,
1133,
7,
16,
11,
220,
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_read_returns_events_if_source_has_events() {
const EVENT: InternalEvent = InternalEvent::Event(Event::Resize(10, 10));
let source = FakeSource::with_events(&[EVENT, EVENT, EVENT]);
let mut reader = InternalEventReader {
events: VecDeque::new(),
source: Some(Box::new(source)),
};
assert_eq!(reader.read(&InternalEventFilter).unwrap(), EVENT);
assert_eq!(reader.read(&InternalEventFilter).unwrap(), EVENT);
assert_eq!(reader.read(&InternalEventFilter).unwrap(), EVENT);
} | rust_cleaned_test_functions.jsonl/101476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
58900,
19691,
11119,
10347,
21778,
19691,
368,
341,
286,
733,
12742,
25,
15412,
1556,
284,
15412,
1556,
486,
1556,
30469,
486,
30561,
7,
16,
15,
11,
220,
16,
15,
3237,
286,
1077,
2530,
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_slice_partition_dedup_empty() {
let mut slice: [i32; 0] = [];
let (dedup, duplicates) = slice.partition_dedup();
assert_eq!(dedup, []);
assert_eq!(duplicates, []);
} | rust_cleaned_test_functions.jsonl/9702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
43840,
814,
291,
454,
15124,
368,
341,
262,
1077,
5206,
15983,
25,
508,
72,
18,
17,
26,
220,
15,
60,
284,
15436,
262,
1077,
320,
9789,
454,
11,
42328,
8,
284,
15983,
79009,
814,
291,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_password() {
let cases = vec![
("TiKV", "*cca644408381f962dba8dfb9889db1371ee74208"),
("Pingcap", "*f33bc75eac70ac317621fbbfa560d6251c43cf8a"),
("rust", "*090c2b08e0c1776910e777b917c2185be6554c2e"),
("database", "*02e86b4af5219d0ba6c974908aea62d42eb7da24"),
("raft", "*b23a77787ed44e62ef2570f03ce8982d119fb699"),
];
for (input, output) in cases {
let res = RpnFnScalarEvaluator::new()
.push_param(Some(Bytes::from(input)))
.evaluate::<Bytes>(ScalarFuncSig::Password)
.unwrap();
assert_eq!(res, Some(Bytes::from(output)))
}
// test for null
let res = RpnFnScalarEvaluator::new()
.push_param(ScalarValue::Bytes(None))
.evaluate::<Bytes>(ScalarFuncSig::Password)
.unwrap();
assert_eq!(None, res)
} | rust_cleaned_test_functions.jsonl/93078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 540
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10122,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
45351,
82707,
497,
15630,
24441,
21,
19,
19,
19,
15,
23,
18,
23,
16,
69,
24,
21,
17,
89455,
23,
2940,
65,
24,
23,
23,
24,
199... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_receiving_user_sabm_before_mux_startup_is_rejected() {
let mut exec = fasync::Executor::new().unwrap();
let (mut session, mut outgoing_frames, _rfcomm_channels) = setup_session();
assert_eq!(session.role(), Role::Unassigned);
// Expect a DM response due to user DLCI SABM before Mux DLCI SABM.
let sabm = Frame::make_sabm_command(Role::Initiator, DLCI::try_from(3).unwrap());
handle_and_expect_frame(
&mut exec,
&mut session,
&mut outgoing_frames,
sabm,
FrameTypeMarker::DisconnectedMode,
);
} | rust_cleaned_test_functions.jsonl/14925 | {
"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,
1288,
46344,
3317,
643,
370,
76,
23708,
80363,
80858,
6892,
1288,
28303,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
25255,
486,
931,
1005,
15454,
1428,
286,
1077,
320,
6984,
3797,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_bank_hash() {
solana_logger::setup();
use solana_sdk::signature::{Keypair, Signer};
let db = AccountsDb::new(Vec::new(), &ClusterType::Development);
let some_slot: Slot = 0;
let ancestors: Ancestors = [(some_slot, 0)].iter().copied().collect();
let max_accounts = 200;
let mut accounts_keys: Vec<_> = (0..max_accounts)
.into_par_iter()
.map(|_| {
let key = Keypair::new().pubkey();
let lamports = thread_rng().gen_range(0, 100);
let some_data_len = thread_rng().gen_range(0, 1000);
let account = Account::new(lamports, some_data_len, &key);
(key, account)
})
.collect();
let mut existing = HashSet::new();
let mut last_print = Instant::now();
for i in 0..5_000 {
if last_print.elapsed().as_millis() > 5000 {
info!("i: {}", i);
last_print = Instant::now();
}
let num_accounts = thread_rng().gen_range(0, 100);
(0..num_accounts).into_iter().for_each(|_| {
let mut idx;
loop {
idx = thread_rng().gen_range(0, max_accounts);
if existing.contains(&idx) {
continue;
}
existing.insert(idx);
break;
}
accounts_keys[idx].1.lamports = thread_rng().gen_range(0, 1000);
});
let account_refs: Vec<_> = existing
.iter()
.map(|idx| (&accounts_keys[*idx].0, &accounts_keys[*idx].1))
.collect();
db.store_uncached(some_slot, &account_refs);
for (key, account) in &account_refs {
assert_eq!(
db.load_account_hash(&ancestors, &key),
AccountsDb::hash_account(some_slot, &account, &key, &ClusterType::Development)
);
}
existing.clear();
}
} | rust_cleaned_test_functions.jsonl/131810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 998
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
35733,
8950,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
543,
262,
990,
2048,
3362,
61783,
486,
34140,
22964,
6608,
1082,
1310,
11,
7075,
261,
2440,
262,
1077,
2927,
284,
40655,
7994,
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... | 5 |
#[test]
fn test_new_env() {
let node = "1";
let id = "bd65600d-8669-4903-8a14-af88203add38";
let exec_file = "/proc/cpuinfo";
let uid = "1001";
let gid = "1002";
let chroot_base = "/";
let netns = "zzzns";
// This should be fine.
let good_env = Env::new(
make_args(
node,
id,
exec_file,
uid,
gid,
chroot_base,
Some(netns),
true,
),
0,
0,
)
.expect("This new environment should be created successfully.");
let mut chroot_dir = PathBuf::from(chroot_base);
chroot_dir.push(Path::new(exec_file).file_name().unwrap());
chroot_dir.push(id);
chroot_dir.push("root");
assert_eq!(good_env.chroot_dir(), chroot_dir);
assert_eq!(format!("{}", good_env.gid()), gid);
assert_eq!(format!("{}", good_env.uid()), uid);
assert_eq!(good_env.netns, Some(netns.to_string()));
assert!(good_env.daemonize);
let another_good_env = Env::new(
make_args(node, id, exec_file, uid, gid, chroot_base, None, false),
0,
0,
)
.expect("This another new environment should be created successfully.");
assert!(!another_good_env.daemonize);
// Not fine - invalid node.
assert!(Env::new(
make_args("zzz", id, exec_file, uid, gid, chroot_base, None, true),
0,
0,
)
.is_err());
// Not fine - invalid id.
assert!(Env::new(
make_args(
node,
"/ad./sa12",
exec_file,
uid,
gid,
chroot_base,
None,
true
),
0,
0
)
.is_err());
assert!(Env::new(
make_args(
node,
id,
"/this!/file!/should!/not!/exist!/",
uid,
gid,
chroot_base,
None,
true
),
0,
0
)
.is_err());
// Not fine - invalid uid.
assert!(Env::new(
make_args(node, id, exec_file, "zzz", gid, chroot_base, None, true),
0,
0
)
.is_err());
// Not fine - invalid gid.
assert!(Env::new(
make_args(node, id, exec_file, uid, "zzz", chroot_base, None, true),
0,
0
)
.is_err());
} | rust_cleaned_test_functions.jsonl/18851 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1697
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
15879,
368,
341,
286,
1077,
2436,
284,
330,
16,
876,
286,
1077,
877,
284,
330,
8940,
21,
20,
21,
15,
15,
67,
12,
23,
21,
21,
24,
12,
19,
24,
15,
18,
12,
23,
64,
16,
19,
12,
2577,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mean() {
test_case(1.0, 0.1, 0.1, |x| x.mean());
test_case(1.0, 1.0, 1.0, |x| x.mean());
test_almost(10.0, 10.0, 9.5135076986687318362924871772654021925505786260884, 1e-14, |x| x.mean());
test_almost(10.0, 1.0, 0.95135076986687318362924871772654021925505786260884, 1e-15, |x| x.mean());
} | rust_cleaned_test_functions.jsonl/84303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16933,
368,
341,
286,
1273,
19096,
7,
16,
13,
15,
11,
220,
15,
13,
16,
11,
220,
15,
13,
16,
11,
760,
87,
91,
856,
18711,
1423,
286,
1273,
19096,
7,
16,
13,
15,
11,
220,
16,
13,
15,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_escaped() {
let selector_str = r#" "\"" ,",":nth-child(7),"|","\""> test> "x":nth-child(1)"#;
let expected = vec![
SelectorRaw {
node_selectors: vec![NodeSelectorRaw {
node_kind: "\\\"".into(),
nth_child: None,
}],
},
SelectorRaw {
node_selectors: vec![NodeSelectorRaw {
node_kind: ",".into(),
nth_child: Some(7),
}],
},
SelectorRaw {
node_selectors: vec![NodeSelectorRaw {
node_kind: "|".into(),
nth_child: None,
}],
},
SelectorRaw {
node_selectors: vec![
NodeSelectorRaw {
node_kind: "\\\"".into(),
nth_child: None,
},
NodeSelectorRaw {
node_kind: "test".into(),
nth_child: None,
},
NodeSelectorRaw {
node_kind: "x".into(),
nth_child: Some(1),
},
],
},
];
assert_eq!(Ok(("", expected)), selectors(selector_str));
} | rust_cleaned_test_functions.jsonl/56567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 928
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
65826,
368,
341,
286,
1077,
9367,
2895,
284,
435,
55543,
67622,
220,
1154,
497,
788,
51738,
23484,
7,
22,
35393,
91,
2198,
2105,
755,
414,
1273,
29,
330,
87,
788,
51738,
23484,
7,
16,
9940... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_session_config_with_region_and_cacert() {
let mut cacert = tempfile::NamedTempFile::new().unwrap();
write!(
cacert,
r#"-----BEGIN CERTIFICATE-----
MIIBYzCCAQqgAwIBAgIUJcTlPhsFyWG9S0pAAElKuSFEPBYwCgYIKoZIzj0EAwIw
FDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTIwMTAwMjExNTU1NloXDTIwMTEwMTEx
NTU1NlowFDESMBAGA1UEAwwJbG9jYWxob3N0MFkwEwYHKoZIzj0CAQYIKoZIzj0D
AQcDQgAEsfpkV9dAThk54U1K+rXUnNbpwuNo5wCRrKpk+cNR/2HBO8VydNj7dkxs
VBUvI7M9hY8dgg1jBVoPcCf0GSOvuqM6MDgwFAYDVR0RBA0wC4IJbG9jYWxob3N0
MAsGA1UdDwQEAwIHgDATBgNVHSUEDDAKBggrBgEFBQcDATAKBggqhkjOPQQDAgNH
ADBEAiAdjF7484kjb3XJoLbgqnZh4V1yHKs57eBVuil9/V0YugIgLwb/vSUAPowb
hK9jLBzNvo8qzKqaGfnGieuLeXCqFDA=
-----END CERTIFICATE-----"#
)
.unwrap();
cacert.flush().unwrap();
let cfg = CloudConfig {
auth_type: Some("password".into()),
auth: Some(Auth {
auth_url: Some("http://127.0.0.1".into()),
username: Some("vasya".into()),
password: Some("hacker".into()),
project_name: Some("admin".into()),
..Auth::default()
}),
cacert: Some(cacert.path().to_str().unwrap().into()),
region_name: Some("Lapland".into()),
..CloudConfig::default()
};
let sscfg = cfg.create_session_config().unwrap();
assert_eq!(sscfg.region_name.as_ref().unwrap(), "Lapland");
} | rust_cleaned_test_functions.jsonl/99077 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 876
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
12316,
5332,
6615,
20627,
8378,
666,
580,
529,
368,
341,
286,
1077,
5206,
82881,
529,
284,
54819,
486,
15810,
12151,
1703,
486,
931,
1005,
15454,
543,
286,
3270,
33673,
310,
82881,
529,
345,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_contrast_ratio() {
let rgb_white = RgbColor(255, 255, 255);
let rgb_yellow = RgbColor(255, 255, 0);
assert_eq!(rgb_white.find_ratio(&rgb_yellow).floor(), 1.);
let rgb_blue = RgbColor(0, 0, 255);
assert_eq!(rgb_white.find_ratio(&rgb_blue).floor(), 8.);
} | rust_cleaned_test_functions.jsonl/46477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62663,
559,
19917,
368,
341,
286,
1077,
17993,
44431,
284,
431,
9511,
1636,
7,
17,
20,
20,
11,
220,
17,
20,
20,
11,
220,
17,
20,
20,
317,
286,
1077,
17993,
93053,
284,
431,
9511,
1636,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part1() {
assert_eq!(super::part1(INPUT_SMALL), 7 * 5);
assert_eq!(super::part1(INPUT_MED), 22 * 10);
} | rust_cleaned_test_functions.jsonl/86116 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
16,
368,
341,
286,
2060,
10714,
10297,
9522,
486,
4480,
16,
57911,
56207,
701,
220,
22,
353,
220,
20,
317,
286,
2060,
10714,
10297,
9522,
486,
4480,
16,
57911,
97550,
701,
220,
17,
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 |
#[test]
fn test_negation() {
let a = Fp2 {
c0: Fp::from_raw_unchecked([
0xc9a2_1831_63ee_70d4,
0xbc37_70a7_196b_5c91,
0xa247_f8c1_304c_5f44,
0xb01f_c2a3_726c_80b5,
0xe1d2_93e5_bbd9_19c9,
0x04b7_8e80_020e_f2ca,
]),
c1: Fp::from_raw_unchecked([
0x952e_a446_0462_618f,
0x238d_5edd_f025_c62f,
0xf6c9_4b01_2ea9_2e72,
0x03ce_24ea_c1c9_3808,
0x0559_50f9_45da_483c,
0x010a_768d_0df4_eabc,
]),
};
let b = Fp2 {
c0: Fp::from_raw_unchecked([
0xf05c_e7ce_9c11_39d7,
0x6274_8f57_97e8_a36d,
0xc4e8_d9df_c664_96df,
0xb457_88e1_8118_9209,
0x6949_13d0_8772_930d,
0x1549_836a_3770_f3cf,
]),
c1: Fp::from_raw_unchecked([
0x24d0_5bb9_fb9d_491c,
0xfb1e_a120_c12e_39d0,
0x7067_879f_c807_c7b1,
0x60a9_269a_31bb_dab6,
0x45c2_56bc_fd71_649b,
0x18f6_9b5d_2b8a_fbde,
]),
};
assert_eq!(-a, b);
} | rust_cleaned_test_functions.jsonl/32510 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 868
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
367,
368,
341,
262,
1077,
264,
284,
434,
79,
17,
341,
286,
272,
15,
25,
434,
79,
486,
1499,
16067,
4907,
7549,
8956,
310,
220,
15,
8148,
24,
64,
17,
62,
16,
23,
18,
16,
62,
21,
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_handshake_fragmented_reads() {
// create an in-memory socket for testing
let (mut dialer_socket, mut listener_socket) = ReadWriteTestSocket::new_pair();
// fragment reads
dialer_socket.set_fragmented_read();
listener_socket.set_fragmented_read();
// get peers
let ((client, _client_public_key), (server, server_public_key)) = build_peers(false);
// perform the handshake
let (client_session, server_session) = block_on(join(
client.upgrade_outbound(dialer_socket, server_public_key, AntiReplayTimestamps::now),
server.upgrade_inbound(listener_socket),
));
client_session.unwrap();
server_session.unwrap();
} | rust_cleaned_test_functions.jsonl/26674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23194,
29661,
43012,
291,
66628,
368,
341,
286,
442,
1855,
458,
304,
64096,
7575,
369,
7497,
198,
286,
1077,
320,
6984,
27860,
261,
19555,
11,
5206,
11446,
19555,
8,
284,
4457,
7985,
2271,
10286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_post() {
let message = Message::new();
let msg_bytes = message.to_vec().unwrap();
let len = msg_bytes.len();
let stream = TestBytesStream(vec![Ok(Bytes::from(msg_bytes))]);
let request = request::new("ns.example.com", len).unwrap();
let request = request.map(|()| stream);
let mut from_post = message_from(Arc::new("ns.example.com".to_string()), request);
let bytes = match from_post.poll() {
Ok(Async::Ready(bytes)) => bytes,
e @ _ => panic!("{:#?}", e),
};
let msg_from_post = Message::from_vec(bytes.as_ref()).expect("bytes failed");
assert_eq!(message, msg_from_post);
} | rust_cleaned_test_functions.jsonl/130325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
6333,
368,
341,
286,
1077,
1943,
284,
4856,
486,
931,
543,
286,
1077,
3750,
12524,
284,
1943,
2389,
13251,
1005,
15454,
543,
286,
1077,
2422,
284,
3750,
12524,
19406,
543,
286,
1077,
4269,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_session_bus_path() {
let path = "unix:path=/tmp/dbus-test-not-exist";
let abstract_path = "unix:abstract=/tmp/dbus-test";
let abstract_path_with_keys = "unix:abstract=/tmp/dbus-test,guid=aaaaaaaa,test=bbbbbbbb";
let addr = parse_dbus_addr_str(path);
assert!(addr.is_err());
let addr = parse_dbus_addr_str(abstract_path).unwrap();
assert_eq!(addr, UnixAddr::new_abstract(b"/tmp/dbus-test").unwrap());
let addr = parse_dbus_addr_str(abstract_path_with_keys).unwrap();
assert_eq!(addr, UnixAddr::new_abstract(b"/tmp/dbus-test").unwrap());
} | rust_cleaned_test_functions.jsonl/23531 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
12316,
25418,
2638,
368,
341,
286,
1077,
1815,
284,
330,
56646,
71796,
23286,
5173,
29357,
355,
16839,
29169,
10187,
380,
876,
286,
1077,
8115,
2638,
284,
330,
56646,
25,
16249,
23286,
5173,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_memory_region() {
let regions_summary = [];
assert_eq!(
format!(
"{:?}",
new_guest_memory_mmap(®ions_summary).err().unwrap()
),
format!("{:?}", Error::NoMemoryRegion)
);
assert_eq!(
format!(
"{:?}",
new_guest_memory_mmap_with_files(®ions_summary)
.err()
.unwrap()
),
format!("{:?}", Error::NoMemoryRegion)
);
assert_eq!(
format!(
"{:?}",
new_guest_memory_mmap_from_regions(®ions_summary)
.err()
.unwrap()
),
format!("{:?}", Error::NoMemoryRegion)
);
assert_eq!(
format!(
"{:?}",
new_guest_memory_mmap_from_arc_regions(®ions_summary)
.err()
.unwrap()
),
format!("{:?}", Error::NoMemoryRegion)
);
} | rust_cleaned_test_functions.jsonl/63913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 714
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
19195,
20627,
368,
341,
286,
1077,
13604,
27251,
284,
15436,
286,
2060,
10714,
33673,
310,
3561,
33673,
394,
13868,
76475,
24375,
394,
501,
62739,
19195,
717,
2186,
2099,
57708,
27251,
568,
61... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fde_incomplete_cie_pointer_32() {
let kind = debug_frame_be();
let section = Section::with_endian(kind.endian())
// The length is not large enough to contain the CIE pointer.
.B32(3)
.B32(1994);
let section = section.get_contents().unwrap();
let debug_frame = kind.section(§ion);
let rest = &mut EndianSlice::new(§ion, BigEndian);
assert_eq!(
parse_fde(debug_frame, rest, UnwindSection::cie_from_offset).map_eof(§ion),
Err(Error::UnexpectedEof(ReaderOffsetId(4)))
);
} | rust_cleaned_test_functions.jsonl/9305 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
761,
450,
1243,
14737,
666,
645,
21425,
62,
18,
17,
368,
341,
286,
1077,
3093,
284,
7390,
8929,
21263,
543,
286,
1077,
3772,
284,
11113,
486,
4197,
87193,
62697,
5073,
1103,
2398,
310,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_byte_count() {
let valid_input = [
("0", 0),
("50K", 50 * 1024),
("50k", 50 * 1024),
("1M", 1024 * 1024),
("100M", 100 * 1024 * 1024),
#[cfg(not(target_pointer_width = "32"))]
("1000G", 1000 * 1024 * 1024 * 1024),
#[cfg(not(target_pointer_width = "32"))]
("10T", 10 * 1024 * 1024 * 1024 * 1024),
("1b", 1),
("1024b", 1024),
("1024Mb", 1024 * 1024 * 1024), // NOTE: This might not be how GNU `sort` behaves for 'Mb'
("1", 1024), // K is default
("50", 50 * 1024),
("K", 1024),
("k", 1024),
("m", 1024 * 1024),
#[cfg(not(target_pointer_width = "32"))]
("E", 1024 * 1024 * 1024 * 1024 * 1024 * 1024),
];
for (input, expected_output) in &valid_input {
assert_eq!(
GlobalSettings::parse_byte_count(input),
Ok(*expected_output)
);
}
// SizeTooBig
let invalid_input = ["500E", "1Y"];
for input in &invalid_input {
#[cfg(not(target_pointer_width = "128"))]
assert!(GlobalSettings::parse_byte_count(input).is_err());
}
// ParseFailure
let invalid_input = ["nonsense", "1B", "B", "b", "p", "e", "z", "y"];
for input in &invalid_input {
assert!(GlobalSettings::parse_byte_count(input).is_err());
}
} | rust_cleaned_test_functions.jsonl/31610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 834
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
19737,
3180,
368,
341,
286,
1077,
2697,
5898,
284,
2278,
310,
3489,
15,
497,
220,
15,
1326,
310,
3489,
20,
15,
42,
497,
220,
20,
15,
353,
220,
16,
15,
17,
19,
1326,
310,
3489,
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... | 4 |
#[test]
fn test_convert_utf8_to_utf16_without_replacement() {
let mut buf = [0u16; 5];
assert_eq!(
convert_utf8_to_utf16_without_replacement(b"ab", &mut buf[..2]),
Some(2)
);
assert_eq!(buf[0], u16::from(b'a'));
assert_eq!(buf[1], u16::from(b'b'));
assert_eq!(buf[2], 0);
assert_eq!(
convert_utf8_to_utf16_without_replacement(b"\xC3\xA4c", &mut buf[..3]),
Some(2)
);
assert_eq!(buf[0], 0xE4);
assert_eq!(buf[1], u16::from(b'c'));
assert_eq!(buf[2], 0);
assert_eq!(
convert_utf8_to_utf16_without_replacement(b"\xE2\x98\x83", &mut buf[..3]),
Some(1)
);
assert_eq!(buf[0], 0x2603);
assert_eq!(buf[1], u16::from(b'c'));
assert_eq!(buf[2], 0);
assert_eq!(
convert_utf8_to_utf16_without_replacement(b"\xE2\x98\x83d", &mut buf[..4]),
Some(2)
);
assert_eq!(buf[0], 0x2603);
assert_eq!(buf[1], u16::from(b'd'));
assert_eq!(buf[2], 0);
assert_eq!(
convert_utf8_to_utf16_without_replacement(b"\xE2\x98\x83\xC3\xA4", &mut buf[..5]),
Some(2)
);
assert_eq!(buf[0], 0x2603);
assert_eq!(buf[1], 0xE4);
assert_eq!(buf[2], 0);
assert_eq!(
convert_utf8_to_utf16_without_replacement(b"\xF0\x9F\x93\x8E", &mut buf[..4]),
Some(2)
);
assert_eq!(buf[0], 0xD83D);
assert_eq!(buf[1], 0xDCCE);
assert_eq!(buf[2], 0);
assert_eq!(
convert_utf8_to_utf16_without_replacement(b"\xF0\x9F\x93\x8Ee", &mut buf[..5]),
Some(3)
);
assert_eq!(buf[0], 0xD83D);
assert_eq!(buf[1], 0xDCCE);
assert_eq!(buf[2], u16::from(b'e'));
assert_eq!(
convert_utf8_to_utf16_without_replacement(b"\xF0\x9F\x93", &mut buf[..5]),
None
);
} | rust_cleaned_test_functions.jsonl/27331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
39453,
23,
2346,
39453,
16,
21,
39904,
1288,
16101,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
84,
16,
21,
26,
220,
20,
935,
286,
2060,
10714,
33673,
310,
5508,
39453,
23,
2346,
394... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intv_cmp_nq(){
let o = Interval::open(3,5);
let c = Interval::closed(3,5);
assert!(o>Interval::open(1,2));
assert!(o>Interval::open(1,3));
assert!(!(o>Interval::open(1,4)));
assert!(c>Interval::open(1,2));
assert!(c>Interval::open(1,3));
assert!(!(c>Interval::open(1,4)));
assert!(o>Interval::closed(1,2));
assert!(o>Interval::closed(1,3));
assert!(!(o>Interval::closed(1,4)));
assert!(c>Interval::closed(1, 2));
assert!(!(c>Interval::closed(1,3)));
assert!(!(c>Interval::closed(1,4)));
assert!(o<Interval::open(6,7));
assert!(o<Interval::open(5,7));
assert!(!(o<Interval::open(4,7)));
assert!(c<Interval::open(6,7));
assert!(c<Interval::open(5,7));
assert!(!(c<Interval::open(4,7)));
assert!(o<Interval::closed(6,7));
assert!(o<Interval::closed(5,7));
assert!(!(o<Interval::closed(4,7)));
assert!(c<Interval::closed(6,7));
assert!(!(c<Interval::closed(5,7)));
assert!(!(c<Interval::closed(4,7)));
} | rust_cleaned_test_functions.jsonl/107810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 626
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
85,
35193,
1089,
80,
3032,
286,
1077,
297,
284,
40584,
486,
2508,
7,
18,
11,
20,
317,
286,
1077,
272,
284,
40584,
486,
34087,
7,
18,
11,
20,
626,
286,
2060,
10297,
78,
29,
10256,
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_circle_undirected() {
type Cost = i32;
let neigh: Vec<Vec<(usize, Cost)>> = vec![
vec![(1, 1), (4, 1)],
vec![(2, 1), (0, 1)],
vec![(3, 1), (1, 1)],
vec![(4, 1), (2, 1)],
vec![(0, 1), (3, 1)],
];
let expected = vec![Real(0), Real(1), Real(2), Real(2), Real(1)];
assert_eq!(dijkstra(0, &neigh), expected);
} | rust_cleaned_test_functions.jsonl/98952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42222,
62,
1241,
74612,
368,
341,
286,
943,
11194,
284,
600,
18,
17,
280,
286,
1077,
96166,
25,
11312,
50439,
28706,
51878,
11,
11194,
54229,
284,
7486,
90515,
310,
7486,
0,
9697,
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... | 1 |
#[test]
fn test_object_merge() {
let ns = "person{}";
let results = Namespace::parse(ns).unwrap();
let expected = vec![
Namespace::Object {
id: "person".into(),
},
Namespace::MergeObject,
];
assert_eq!(expected, results);
} | rust_cleaned_test_functions.jsonl/93991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
20888,
368,
341,
286,
1077,
12268,
284,
330,
8987,
6257,
876,
286,
1077,
3059,
284,
41962,
486,
6400,
39417,
568,
15454,
543,
286,
1077,
3601,
284,
7486,
90515,
310,
41962,
486,
1190,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_writer_with_codec() {
let schema = Schema::parse_str(SCHEMA).unwrap();
let writer = make_writer_with_codec(&schema);
check_writer(writer, &schema);
} | rust_cleaned_test_functions.jsonl/37663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28908,
6615,
51084,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
59461,
35839,
568,
15454,
543,
286,
1077,
6916,
284,
1281,
28908,
6615,
51084,
2099,
17349,
317,
286,
1779,
28908,
38356,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_long_format_multiple_users() {
let scene = TestScenario::new(util_name!());
let expected = scene
.cmd_keepenv(util_name!())
.env("LANGUAGE", "C")
.arg("-l")
.arg("root")
.arg("root")
.arg("root")
.succeeds();
scene
.ucmd()
.arg("-l")
.arg("root")
.arg("root")
.arg("root")
.succeeds()
.stdout_is(expected.stdout_str());
} | rust_cleaned_test_functions.jsonl/72620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
8955,
45233,
16348,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
5231,
262,
1077,
3601,
284,
6109,
198,
286,
659,
8710,
50293,
3160,
67811,
1269,
0,
2398,
286,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_auto_import_split_self_for_target() {
check_assist(
add_import,
"
use std::fmt::Debug;
impl std::fmt<|> for Foo {
}
",
"
use std::fmt::{ self, Debug};
impl fmt<|> for Foo {
}
",
);
} | rust_cleaned_test_functions.jsonl/39953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27740,
18434,
17052,
25637,
5478,
11123,
368,
341,
286,
1779,
12083,
380,
1006,
310,
912,
18434,
345,
310,
6228,
810,
1460,
486,
12501,
486,
7939,
401,
6383,
1460,
486,
12501,
27,
91,
29,
369,
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_from_into_cose_key() {
let mut rng = ThreadRng256 {};
let sk = crypto::ecdh::SecKey::gensk(&mut rng);
let pk = sk.genpk();
let cose_key = CoseKey::from(pk.clone());
let created_pk = ecdh::PubKey::try_from(cose_key);
assert_eq!(created_pk, Ok(pk));
} | rust_cleaned_test_functions.jsonl/49013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
45514,
666,
960,
3097,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
9321,
286,
1077,
1901,
284,
19028,
486,
757,
30621,
486,
8430,
1592,
486,
58305,
74,
2099,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fmt_debug_up_to_20_elements() {
(1..=20).for_each(|i| {
let values = (0..i).collect::<Vec<i16>>();
let array_expected = format!(
"PrimitiveArray<Int16>\n[\n{}\n]",
values
.iter()
.map(|v| { format!(" {},", v) })
.collect::<Vec<String>>()
.join("\n")
);
let array = Int16Array::from(values);
assert_eq!(array_expected, format!("{:?}", array));
})
} | rust_cleaned_test_functions.jsonl/27285 | {
"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,
38128,
15446,
8237,
2346,
62,
17,
15,
22801,
368,
341,
286,
320,
16,
496,
28,
17,
15,
568,
1958,
32046,
22428,
72,
91,
341,
310,
1077,
2750,
284,
320,
15,
496,
72,
568,
17384,
27638,
10050,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_invalid_csv() {
let file = File::open("test/data/various_types_invalid.csv").unwrap();
let schema = Schema::new(vec![
Field::new("c_int", DataType::UInt64, false),
Field::new("c_float", DataType::Float32, false),
Field::new("c_string", DataType::Utf8, false),
Field::new("c_bool", DataType::Boolean, false),
]);
let builder = ReaderBuilder::new()
.with_schema(Arc::new(schema))
.has_header(true)
.with_delimiter(b'|')
.with_batch_size(512)
.with_projection(vec![0, 1, 2, 3]);
let mut csv = builder.build(file).unwrap();
match csv.next() {
Some(e) => match e {
Err(e) => assert_eq!(
"ParseError(\"Error while parsing value 4.x4 for column 1 at line 4\")",
format!("{:?}", e)
),
Ok(_) => panic!("should have failed"),
},
None => panic!("should have failed"),
}
} | rust_cleaned_test_functions.jsonl/16417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 578
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
31433,
14020,
368,
341,
286,
1077,
1034,
284,
2887,
486,
2508,
445,
1944,
13167,
92146,
1223,
9763,
31433,
11219,
1827,
15454,
1428,
286,
1077,
10802,
284,
12539,
486,
931,
25592,
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... | 3 |
#[test]
fn test_from_partition_summaries() {
let partitions = vec![
PartitionSummary {
key: "p1".to_string(),
table: TableSummary {
name: "t1".to_string(),
columns: vec![
ColumnSummary {
name: "c1".to_string(),
influxdb_type: Some(InfluxDbType::Tag),
stats: Statistics::I64(StatValues::new_with_value(23)),
},
ColumnSummary {
name: "c2".to_string(),
influxdb_type: Some(InfluxDbType::Field),
stats: Statistics::I64(StatValues::new_with_value(43)),
},
ColumnSummary {
name: "c3".to_string(),
influxdb_type: None,
stats: Statistics::String(StatValues::new_with_value(
"foo".to_string(),
)),
},
ColumnSummary {
name: "time".to_string(),
influxdb_type: Some(InfluxDbType::Timestamp),
stats: Statistics::I64(StatValues::new_with_value(43)),
},
],
},
},
PartitionSummary {
key: "p3".to_string(),
table: TableSummary {
name: "t1".to_string(),
columns: vec![],
},
},
];
let expected = vec![
"+---------------+------------+-------------+-------------+---------------+",
"| partition_key | table_name | column_name | column_type | influxdb_type |",
"+---------------+------------+-------------+-------------+---------------+",
"| p1 | t1 | c1 | I64 | Tag |",
"| p1 | t1 | c2 | I64 | Field |",
"| p1 | t1 | c3 | String | |",
"| p1 | t1 | time | I64 | Timestamp |",
"+---------------+------------+-------------+-------------+---------------+",
];
let batch = from_partition_summaries(partition_summaries_schema(), partitions).unwrap();
assert_batches_eq!(&expected, &[batch]);
} | rust_cleaned_test_functions.jsonl/94370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1618
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
43840,
10160,
89333,
368,
341,
286,
1077,
46688,
284,
7486,
90515,
310,
54626,
19237,
341,
394,
1376,
25,
330,
79,
16,
3263,
983,
3904,
3148,
394,
1965,
25,
6633,
19237,
341,
503,
829,
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_lazy_exec() {
let df = get_df();
let new = df
.clone()
.lazy()
.select([col("sepal.width"), col("variety")])
.sort("sepal.width", false)
.collect();
println!("{:?}", new);
let new = df
.lazy()
.filter(not(col("sepal.width").lt(lit(3.5))))
.collect()
.unwrap();
let check = new.column("sepal.width").unwrap().f64().unwrap().gt(3.4);
assert!(check.all())
} | rust_cleaned_test_functions.jsonl/104 | {
"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,
49646,
18430,
368,
341,
262,
1077,
6764,
284,
633,
10894,
543,
262,
1077,
501,
284,
6764,
198,
286,
659,
19982,
741,
286,
659,
49013,
741,
286,
659,
1742,
2561,
2074,
445,
325,
19308,
5441,
3975... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_str_ascii() {
Python::with_gil(|py| {
let s = "ascii 🐈";
let obj: PyObject = PyString::new(py, s).into();
let py_string = <PyString as PyTryFrom>::try_from(obj.as_ref(py)).unwrap();
assert_eq!(s, py_string.to_str().unwrap());
})
} | rust_cleaned_test_functions.jsonl/118016 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
2895,
50238,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
274,
284,
330,
23324,
11162,
238,
230,
876,
310,
1077,
2839,
25,
15891,
284,
5355,
703,
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_conversion_to_int_value() {
let context = Context::create();
let module = context.create_module("testing");
let builder = context.create_builder();
// Create a function whose the first parameter is of IntType
let i64_type = context.i64_type();
let fn_type = context.void_type().fn_type(&[i64_type.into()], false);
let function = module.add_function("testing", fn_type, None);
let basic_block = context.append_basic_block(function, "entry");
builder.position_at_end(basic_block);
// Create an IntType instruction
let int_arg = function.get_nth_param(0).unwrap().into_int_value();
let int_const = i64_type.const_int(1, false);
let int_instr = builder
.build_int_add(int_arg, int_const, "add")
.as_instruction()
.unwrap();
// Test the instruction conversion to an IntValue
let int_conversion: Result<IntValue, _> = int_instr.try_into();
assert!(int_conversion.is_ok());
// Test the instruction conversion to other LLVM Values
let float_conversion: Result<FloatValue, _> = int_instr.try_into();
assert!(float_conversion.is_err());
let ptr_conversion: Result<PointerValue, _> = int_instr.try_into();
assert!(ptr_conversion.is_err());
} | rust_cleaned_test_functions.jsonl/134456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 468
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64132,
2346,
4042,
3142,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
8840,
797,
262,
1077,
7363,
284,
2266,
2520,
28532,
1428,
262,
442,
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_proposal_generation_parent() {
let block_store = build_empty_tree();
let mut inserter = TreeInserter::new(block_store.clone());
let proposal_generator = ProposalGenerator::new(
block_store.clone(),
Arc::new(MockTransactionManager::new()),
Arc::new(SimulatedTimeService::new()),
1,
true,
);
let genesis = block_store.root();
let a1 = inserter.insert_block_with_qc(QuorumCert::certificate_for_genesis(), &genesis, 1);
let b1 = inserter.insert_block_with_qc(QuorumCert::certificate_for_genesis(), &genesis, 2);
// With no certifications the parent is genesis
// generate proposals for an empty tree.
assert_eq!(
block_on(proposal_generator.generate_proposal(10, minute_from_now()))
.unwrap()
.parent_id(),
genesis.id()
);
inserter.insert_qc_for_block(a1.as_ref(), None);
let a1_child_res =
block_on(proposal_generator.generate_proposal(11, minute_from_now())).unwrap();
assert_eq!(a1_child_res.parent_id(), a1.id());
assert_eq!(a1_child_res.round(), 11);
assert_eq!(a1_child_res.quorum_cert().certified_block().id(), a1.id());
inserter.insert_qc_for_block(b1.as_ref(), None);
let b1_child_res =
block_on(proposal_generator.generate_proposal(12, minute_from_now())).unwrap();
assert_eq!(b1_child_res.parent_id(), b1.id());
assert_eq!(b1_child_res.round(), 12);
assert_eq!(b1_child_res.quorum_cert().certified_block().id(), b1.id());
} | rust_cleaned_test_functions.jsonl/132668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 680
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21663,
32556,
64191,
15960,
368,
341,
262,
1077,
2504,
14809,
284,
1936,
15124,
11663,
543,
262,
1077,
5206,
47325,
465,
284,
8942,
641,
90727,
486,
931,
18682,
14809,
15997,
1423,
262,
1077,
13734,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_storage_remove_account_double_remove() {
let accounts = AccountsDB::new(Vec::new());
let pubkey = Pubkey::new_rand();
let account = Account::new(1, 0, &Account::default().owner);
accounts.store(0, &[(&pubkey, &account)]);
let storage = accounts.storage.read().unwrap();
let storage_entry = storage.0[&0].values().next().unwrap();
storage_entry.remove_account();
storage_entry.remove_account();
} | rust_cleaned_test_functions.jsonl/33699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
18193,
13500,
24598,
18193,
368,
341,
286,
1077,
9618,
284,
40655,
3506,
486,
931,
49923,
486,
931,
1423,
286,
1077,
95116,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
2692,
284,
8615... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_let_statement() {
let input = "
let x = 5;
let y = 10;
let foobar = 838383;
";
let mut program = parse_statements(input);
assert_eq!(3, program.len());
let line1 = program.remove(0);
let rhs = verify_let_statement(line1, "x");
verify_int_literal(5, "5", &rhs);
let line2 = program.remove(0);
let rhs = verify_let_statement(line2, "y");
verify_int_literal(10, "10", &rhs);
let line3 = program.remove(0);
let rhs = verify_let_statement(line3, "foobar");
verify_int_literal(838383, "838383", &rhs);
} | rust_cleaned_test_functions.jsonl/64064 | {
"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,
21039,
62,
1149,
37404,
368,
341,
286,
1077,
1946,
284,
6228,
688,
1077,
856,
284,
220,
20,
280,
688,
1077,
379,
284,
220,
16,
15,
280,
688,
1077,
11756,
31393,
284,
220,
23,
18,
23,
18,
23,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_attr_query_items() {
let querier = new_valid_db("attr_query_items.db");
let attrs = vec!["red"];
let items = querier.query_items(None, Some(attrs), None);
assert_eq!(2, items.len());
let attrs = vec!["fairy", "poisoned"];
let items = querier.query_items(None, Some(attrs), None);
assert_eq!(1, items.len());
} | rust_cleaned_test_functions.jsonl/107669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10422,
5738,
12134,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
2991,
5738,
12134,
7076,
3071,
286,
1077,
16204,
284,
7486,
0,
1183,
1151,
6332,
286,
1077,
3589,
284,
29134,
1268,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_with_mut() {
let mut m = TreeMap::new();
assert!(m.insert("t1", 12i).is_none());
assert!(m.insert("t2", 8).is_none());
assert!(m.insert("t5", 14).is_none());
let new = 100;
match m.find_with_mut(|&k| "t5".cmp(k)) {
None => panic!(), Some(x) => *x = new
}
assert_eq!(m.find_with(|&k| "t5".cmp(k)), Some(&new));
} | rust_cleaned_test_functions.jsonl/88288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
6615,
29523,
368,
341,
286,
1077,
5206,
296,
284,
76883,
486,
931,
543,
286,
2060,
10297,
76,
7030,
445,
83,
16,
497,
220,
16,
17,
72,
568,
285,
31488,
1423,
286,
2060,
10297,
76,
7030,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_convert_index_expression() {
let b = ast::BaseNode::default();
let pkg =
Parser::new("a[3]").parse_single_package("path".to_string(), "foo.flux".to_string());
let got = test_convert(pkg).unwrap();
let symbols = collect_symbols(&got);
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![Statement::Expr(ExprStmt {
loc: b.location.clone(),
expression: Expression::Index(Box::new(IndexExpr {
loc: b.location.clone(),
typ: type_info(),
array: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: symbols["a"].clone(),
}),
index: Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 3,
}),
})),
})],
}],
};
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/131381 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 812
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
3560,
28068,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
4035,
310,
21102,
486,
931,
445,
64,
58,
18,
44891,
6400,
19487,
26328,
445,
2343,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_chain() {
let mut data = vec![1.0, 2.0, 3.0, 4.0, 5.0].into_iter();
let mut filt1 = fir::Fir::new(vec![0.5, 0.5], &mut data);
let x2s = filt1.output();
let mut filt2 = fir::Fir::new(vec![1.], x2s);
let ys = filt2.output();
let expected = vec![0.5, 1.5, 2.5, 3.5, 4.5, 2.5];
for (y, ex) in ys.zip(expected) {
assert_eq!(y, ex);
}
} | rust_cleaned_test_functions.jsonl/31420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
30583,
368,
341,
262,
1077,
5206,
821,
284,
7486,
20703,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
11,
220,
19,
13,
15,
11,
220,
20,
13,
15,
936,
18122,
11723,
543,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_enforce_limit_error_event() {
let mut envelope = envelope![Event];
let mut mock = MockLimiter::default().deny(DataCategory::Error);
let (_, limits) = EnvelopeLimiter::new(|s, q| mock.check(s, q))
.enforce(&mut envelope, &scoping())
.unwrap();
assert!(limits.is_limited());
assert!(envelope.is_empty());
mock.assert_call(DataCategory::Error, Some(1));
mock.assert_call(DataCategory::Attachment, None);
mock.assert_call(DataCategory::Session, None);
} | rust_cleaned_test_functions.jsonl/101161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
8833,
14763,
4096,
6748,
368,
341,
286,
1077,
5206,
34398,
284,
34398,
20703,
1556,
4821,
286,
1077,
5206,
7860,
284,
14563,
43,
17700,
486,
2258,
1005,
89963,
18959,
6746,
486,
1454,
317,
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_flags_query_dialogues() {
let querier = new_valid_db("flag_query_dialogues.db");
let flags = vec!["grounded"];
let dialogues = querier.query_dialogues(None, Some(flags), None, None);
assert_eq!(2, dialogues.len());
let flags = vec!["fairy", "poisoned"];
let dialogues = querier.query_dialogues(None, Some(flags), None, None);
assert_eq!(1, dialogues.len());
} | rust_cleaned_test_functions.jsonl/107704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14130,
5738,
24331,
1137,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
9903,
5738,
24331,
1137,
7076,
3071,
286,
1077,
8042,
284,
7486,
0,
1183,
1951,
291,
6332,
286,
1077,
7254,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_decimal_wrong_precision() {
let a = PrimitiveArray::from([None]).to(DataType::Decimal(5, 2));
let b = PrimitiveArray::from([None]).to(DataType::Decimal(6, 2));
let result = add(&a, &b);
if result.is_ok() {
panic!("Should panic for different precision");
}
} | rust_cleaned_test_functions.jsonl/6874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
74429,
75198,
54618,
368,
341,
286,
1077,
264,
284,
51460,
1857,
486,
1499,
2561,
4064,
10697,
983,
63941,
486,
11269,
7,
20,
11,
220,
17,
1106,
286,
1077,
293,
284,
51460,
1857,
486,
1499... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_has_wpa3_capable_client_success() {
let mut test_values = test_setup();
// Query whether there is an iface that can do WPA3.
let has_wpa3_fut = test_values.iface_manager.has_wpa3_capable_client();
pin_mut!(has_wpa3_fut);
assert_variant!(test_values.exec.run_until_stalled(&mut has_wpa3_fut), Poll::Pending);
// Verify that the service sees the query
let next_message = test_values.receiver.next();
pin_mut!(next_message);
assert_variant!(
test_values.exec.run_until_stalled(&mut next_message),
Poll::Ready(
Some(IfaceManagerRequest::HasWpa3Iface(HasWpa3IfaceRequest{ responder}))
) => responder.send(true).expect("failed to reply to wpa3 iface query")
);
// Verify that the client side finishes
assert_variant!(
test_values.exec.run_until_stalled(&mut has_wpa3_fut),
Poll::Ready(Ok(true))
);
} | rust_cleaned_test_functions.jsonl/59195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21778,
1670,
6595,
18,
16388,
480,
8179,
18632,
368,
341,
286,
1077,
5206,
1273,
9146,
284,
1273,
21363,
1428,
286,
442,
11361,
3425,
1052,
374,
458,
49313,
429,
646,
653,
467,
8041,
18,
624,
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_ripemd160() {
let input = &[0xff];
let output = hex_decode("2c0c45d3ecab80fe060e5f1d7057cd2f8de5e557").unwrap();
test_precompile!(Ripemd160, input, output, 720);
} | rust_cleaned_test_functions.jsonl/51964 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
4561,
94110,
16,
21,
15,
368,
341,
262,
1077,
1946,
284,
44590,
15,
9020,
935,
262,
1077,
2550,
284,
12371,
15227,
445,
17,
66,
15,
66,
19,
20,
67,
18,
757,
370,
23,
15,
1859,
15,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pid() {
let mut p = PacketInfo::null_packet();
for pid in 0..8191 {
p.set_pid(pid);
assert_eq!(p.pid(), pid);
}
} | rust_cleaned_test_functions.jsonl/47182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30065,
368,
341,
286,
1077,
5206,
281,
284,
28889,
1731,
486,
2921,
21078,
543,
286,
369,
14814,
304,
220,
15,
496,
23,
16,
24,
16,
341,
310,
281,
980,
30065,
37844,
317,
310,
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
] | 2 |
#[test]
fn test_nand() {
let mut nand = Nand::new();
nand.a = false;
nand.b = false;
nand.prop();
assert_eq!(nand.out, true);
nand.a = true;
nand.b = false;
nand.prop();
assert_eq!(nand.out, true);
nand.a = false;
nand.b = true;
nand.prop();
assert_eq!(nand.out, true);
nand.a = true;
nand.b = true;
nand.prop();
assert_eq!(nand.out, false);
} | rust_cleaned_test_functions.jsonl/18847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
437,
368,
341,
286,
1077,
5206,
308,
437,
284,
451,
437,
486,
931,
1428,
286,
308,
437,
5849,
284,
895,
280,
286,
308,
437,
948,
284,
895,
280,
286,
308,
437,
18417,
543,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_cpu() {
let bionic = UbuntuDiskConfig::new(BIONIC_IMAGE_NAME.to_string());
let guest = Guest::new(Box::new(bionic));
let mut cmd = GuestCommand::new(&guest);
cmd.args(&["--cpus", "boot=2,max=4"])
.args(&["--memory", "size=512M"])
.args(&["--kernel", direct_kernel_boot_path().to_str().unwrap()])
.args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE])
.capture_output()
.default_disks()
.default_net();
let mut child = cmd.spawn().unwrap();
let r = std::panic::catch_unwind(|| {
guest.wait_vm_boot(Some(120)).unwrap();
assert_eq!(guest.get_cpu_count().unwrap_or_default(), 2);
#[cfg(target_arch = "x86_64")]
assert_eq!(
guest
.ssh_command(r#"dmesg | grep "smpboot: Allowing" | sed "s/\[\ *[0-9.]*\] //""#)
.unwrap()
.trim(),
"smpboot: Allowing 4 CPUs, 2 hotplug CPUs"
);
#[cfg(target_arch = "aarch64")]
assert_eq!(
guest
.ssh_command(r#"dmesg | grep "smp: Brought up" | sed "s/\[\ *[0-9.]*\] //""#)
.unwrap()
.trim(),
"smp: Brought up 1 node, 2 CPUs"
);
});
let _ = child.kill();
let output = child.wait_with_output().unwrap();
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/26098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 866
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
21795,
368,
341,
286,
1077,
293,
20764,
284,
34960,
47583,
2648,
486,
931,
5349,
1271,
1317,
19121,
4708,
2389,
3904,
1423,
286,
1077,
8640,
284,
26215,
486,
931,
67758,
486,
931,
1883,
207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_fourcc() {
let ftyp_fcc = 0x66747970;
let ftyp_value = FourCC::from(ftyp_fcc);
assert_eq!(&ftyp_value.value[..], b"ftyp");
let ftyp_fcc2: u32 = ftyp_value.into();
assert_eq!(ftyp_fcc, ftyp_fcc2);
} | rust_cleaned_test_functions.jsonl/35659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56142,
638,
368,
341,
286,
1077,
282,
3653,
761,
638,
284,
220,
15,
87,
21,
21,
22,
19,
22,
24,
22,
15,
280,
286,
1077,
282,
3653,
3142,
284,
13322,
3706,
486,
1499,
63106,
1082,
761,
638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index_integrity() {
let slot = 1;
let num_entries = 100;
let (data_shreds, coding_shreds, leader_schedule_cache) =
setup_erasure_shreds(slot, 0, num_entries, 1.0);
assert!(data_shreds.len() > 3);
assert!(coding_shreds.len() > 3);
let blocktree_path = get_tmp_ledger_path!();
{
let blocktree = Blocktree::open(&blocktree_path).unwrap();
// Test inserting all the shreds
let all_shreds: Vec<_> = data_shreds
.iter()
.cloned()
.chain(coding_shreds.iter().cloned())
.collect();
blocktree
.insert_shreds(all_shreds, Some(&leader_schedule_cache), false)
.unwrap();
verify_index_integrity(&blocktree, slot);
blocktree.purge_slots(0, Some(slot));
blocktree
.insert_shreds(coding_shreds.clone(), Some(&leader_schedule_cache), false)
.unwrap();
verify_index_integrity(&blocktree, slot);
blocktree.purge_slots(0, Some(slot));
blocktree
.insert_shreds(
coding_shreds[..coding_shreds.len() - 1].to_vec(),
Some(&leader_schedule_cache),
false,
)
.unwrap();
verify_index_integrity(&blocktree, slot);
blocktree.purge_slots(0, Some(slot));
let shreds: Vec<_> = data_shreds[..data_shreds.len() - 1]
.iter()
.cloned()
.chain(coding_shreds[..coding_shreds.len() - 1].iter().cloned())
.collect();
blocktree
.insert_shreds(shreds, Some(&leader_schedule_cache), false)
.unwrap();
verify_index_integrity(&blocktree, slot);
blocktree.purge_slots(0, Some(slot));
let shreds: Vec<_> = data_shreds[..data_shreds.len() / 2 - 1]
.iter()
.cloned()
.chain(coding_shreds[..coding_shreds.len() / 2 - 1].iter().cloned())
.collect();
blocktree
.insert_shreds(shreds, Some(&leader_schedule_cache), false)
.unwrap();
verify_index_integrity(&blocktree, slot);
blocktree.purge_slots(0, Some(slot));
let shreds1: Vec<_> = data_shreds[..data_shreds.len() / 2 - 1]
.iter()
.cloned()
.chain(coding_shreds[..coding_shreds.len() / 2 - 1].iter().cloned())
.collect();
let shreds2: Vec<_> = data_shreds[data_shreds.len() / 2 - 1..]
.iter()
.cloned()
.chain(coding_shreds[coding_shreds.len() / 2 - 1..].iter().cloned())
.collect();
blocktree
.insert_shreds(shreds1, Some(&leader_schedule_cache), false)
.unwrap();
blocktree
.insert_shreds(shreds2, Some(&leader_schedule_cache), false)
.unwrap();
verify_index_integrity(&blocktree, slot);
blocktree.purge_slots(0, Some(slot));
// make sure nothing is lost
let shreds1: Vec<_> = data_shreds[..data_shreds.len() / 2 - 1]
.iter()
.cloned()
.chain(coding_shreds[..coding_shreds.len() / 2 - 1].iter().cloned())
.collect();
let shreds2: Vec<_> = data_shreds[data_shreds.len() / 2 - 1..data_shreds.len() / 2]
.iter()
.cloned()
.chain(
coding_shreds[coding_shreds.len() / 2 - 1..coding_shreds.len() / 2]
.iter()
.cloned(),
)
.collect();
blocktree
.insert_shreds(shreds1, Some(&leader_schedule_cache), false)
.unwrap();
blocktree
.insert_shreds(shreds2, Some(&leader_schedule_cache), false)
.unwrap();
verify_index_integrity(&blocktree, slot);
blocktree.purge_slots(0, Some(slot));
let shreds1: Vec<_> = data_shreds[..data_shreds.len() / 2 - 2]
.iter()
.cloned()
.chain(coding_shreds[..coding_shreds.len() / 2 - 2].iter().cloned())
.collect();
let shreds2: Vec<_> = data_shreds[data_shreds.len() / 2 - 2..data_shreds.len() / 2 - 1]
.iter()
.cloned()
.chain(
coding_shreds[coding_shreds.len() / 2 - 2..coding_shreds.len() / 2 - 1]
.iter()
.cloned(),
)
.collect();
blocktree
.insert_shreds(shreds1, Some(&leader_schedule_cache), false)
.unwrap();
blocktree
.insert_shreds(shreds2, Some(&leader_schedule_cache), false)
.unwrap();
verify_index_integrity(&blocktree, slot);
blocktree.purge_slots(0, Some(slot));
}
Blocktree::destroy(&blocktree_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/116913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
4042,
67212,
368,
341,
286,
1077,
9446,
284,
220,
16,
280,
286,
1077,
1629,
26092,
284,
220,
16,
15,
15,
280,
286,
1077,
320,
691,
3712,
53369,
11,
10822,
3712,
53369,
11,
7653,
34530,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repository_registrations_query() {
assert_eq!(repository_registrations_query(""), format!("{}.", CONFIG_KEY_REGISTRATIONS));
assert_eq!(
repository_registrations_query("a-b"),
format!("{}.a-b", CONFIG_KEY_REGISTRATIONS)
);
assert_eq!(
repository_registrations_query("a.b"),
format!("{}.a%2Eb", CONFIG_KEY_REGISTRATIONS)
);
assert_eq!(
repository_registrations_query("a%b"),
format!("{}.a%25b", CONFIG_KEY_REGISTRATIONS)
);
} | rust_cleaned_test_functions.jsonl/98261 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47301,
4920,
3758,
804,
5738,
368,
341,
286,
2060,
10714,
10297,
23319,
4920,
3758,
804,
5738,
86076,
3561,
17223,
6257,
10465,
13202,
6600,
8064,
29503,
21792,
1106,
286,
2060,
10714,
33673,
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... | 1 |
#[test]
fn test_with_http_and_port_git_url_parts() {
let RemoteParts { domain, repository } =
get_remote_parts("http://host.xz:80/path/to/repo.git/").unwrap();
assert_eq!(domain, "host.xz");
assert_eq!(repository, "path/to/repo");
} | rust_cleaned_test_functions.jsonl/87539 | {
"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,
6615,
25888,
8378,
8716,
68801,
2903,
33217,
368,
341,
286,
1077,
20738,
28921,
314,
7947,
11,
12542,
335,
4035,
310,
633,
36425,
33217,
445,
1254,
1110,
3790,
1993,
89,
25,
23,
15,
50976,
32429,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_credit_with_lua() {
let code = r#"accounts[1].tokens = accounts[1].tokens + 1"#;
let mut accounts = [(Pubkey::default(), Account::default())];
run_lua(&mut create_keyed_accounts(&mut accounts), code, &[]).unwrap();
assert_eq!(accounts[0].1.tokens, 1);
} | rust_cleaned_test_functions.jsonl/113680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51569,
6615,
76013,
368,
341,
286,
1077,
2038,
284,
435,
55543,
26206,
58,
16,
936,
30566,
284,
9618,
58,
16,
936,
30566,
488,
220,
16,
57676,
280,
286,
1077,
5206,
9618,
284,
17826,
29162,
792,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_authorize_ix_ok() {
let nonce_acc = nonce_account::create_account(1_000_000);
process_instruction(
&Pubkey::default(),
vec![
KeyedAccount::new(&Pubkey::default(), true, &nonce_acc),
KeyedAccount::new(
&sysvar::recent_blockhashes::id(),
false,
&create_default_recent_blockhashes_account(),
),
KeyedAccount::new(&sysvar::rent::id(), false, &create_default_rent_account()),
],
&serialize(&SystemInstruction::InitializeNonceAccount(Pubkey::default())).unwrap(),
)
.unwrap();
assert_eq!(
process_instruction(
&Pubkey::default(),
vec![KeyedAccount::new(&Pubkey::default(), true, &nonce_acc,),],
&serialize(&SystemInstruction::AuthorizeNonceAccount(Pubkey::default(),)).unwrap(),
),
Ok(()),
);
} | rust_cleaned_test_functions.jsonl/73075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 544
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
22938,
551,
62686,
19817,
368,
341,
286,
1077,
39676,
17737,
284,
39676,
13500,
486,
3182,
13500,
7,
16,
62,
15,
15,
15,
62,
15,
15,
15,
317,
286,
1882,
54923,
1006,
310,
609,
29162,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_affine_scalar_multiplication() {
let g = G2Affine::generator();
let a = Scalar::from_raw([
0x2b56_8297_a56d_a71c,
0xd8c3_9ecb_0ef3_75d1,
0x435c_38da_67bf_bf96,
0x8088_a050_26b6_59b2,
]);
let b = Scalar::from_raw([
0x785f_dd9b_26ef_8b85,
0xc997_f258_3769_5c18,
0x4c8d_bc39_e7b7_56c1,
0x70d9_b6cc_6d87_df20,
]);
let c = a * b;
assert_eq!(G2Affine::from(g * a) * b, g * c);
} | rust_cleaned_test_functions.jsonl/47809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48914,
482,
41652,
91802,
1693,
368,
341,
262,
1077,
342,
284,
479,
17,
25841,
482,
486,
35851,
543,
262,
1077,
264,
284,
35176,
486,
1499,
16067,
8956,
286,
220,
15,
87,
17,
65,
20,
21,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_value_string() {
let mut v0: String = "foo".to_string();
let v1 = Value::from("bar");
let v1p = "bar";
v0.from_value(v1);
assert_eq!(v0, v1p, "v0 should equal {} but is actually {}", v1p, v0);
// This is a noop and prints an error
v0.from_value(Value::from(-1));
assert_eq!(v0, v1p, "v0 should equal {} but is actually {}", v1p, v0);
} | rust_cleaned_test_functions.jsonl/83578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
3142,
3904,
368,
341,
286,
1077,
5206,
348,
15,
25,
923,
284,
330,
7975,
3263,
983,
3904,
543,
286,
1077,
348,
16,
284,
5162,
486,
1499,
445,
2257,
797,
286,
1077,
348,
16,
79,
284,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_install_target_new_file_with_owner() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "file";
let dir = "target_dir";
let uid = get_effective_uid();
at.touch(file);
at.mkdir(dir);
let result = ucmd
.arg(file)
.arg("--owner")
.arg(uid.to_string())
.arg(format!("{}/{}", dir, file))
.run();
if is_ci() && result.stderr_str().contains("no such user:") {
return;
}
result.success();
assert!(at.file_exists(file));
assert!(at.file_exists(&format!("{}/{}", dir, file)));
} | rust_cleaned_test_functions.jsonl/47027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34245,
11123,
5921,
2458,
6615,
29027,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
284,
330,
1192,
876,
262,
1077,
5419,
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... | 3 |
#[test]
fn test_network_type_is_udp() -> Result<()> {
assert!(NetworkType::Udp4.is_udp());
assert!(NetworkType::Udp6.is_udp());
assert!(!NetworkType::Udp4.is_tcp());
assert!(!NetworkType::Udp6.is_tcp());
Ok(())
} | rust_cleaned_test_functions.jsonl/89876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
1819,
6892,
69432,
368,
1464,
5714,
71698,
341,
262,
2060,
10297,
12320,
929,
486,
52,
9796,
19,
2079,
69432,
1423,
262,
2060,
10297,
12320,
929,
486,
52,
9796,
21,
2079,
69432,
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_zsh_escape() {
let test = "10%";
assert_eq!(wrap_colorseq_for_shell(test.to_owned(), Shell::Zsh), "10%%");
assert_eq!(
wrap_colorseq_for_shell(test.to_owned(), Shell::PowerShell),
test
);
} | rust_cleaned_test_functions.jsonl/56268 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6415,
927,
21832,
368,
341,
286,
1077,
1273,
284,
330,
16,
15,
95670,
286,
2060,
10714,
10297,
10097,
6714,
13262,
5478,
48945,
8623,
2389,
51973,
1507,
29402,
486,
57,
927,
701,
330,
16,
15,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_user_playlist() {
let mut spotify_oauth = SpotifyOAuth::default().build();
match get_token(&mut spotify_oauth) {
Some(token_info) => {
let client_credential = SpotifyClientCredentials::default()
.token_info(token_info)
.build();
let spotify = Spotify::default()
.client_credentials_manager(client_credential)
.build();
let user_id = "spotify";
let mut playlist_id = String::from("59ZbFPES4DQwEjBpWHzrtC");
let playlists = spotify.user_playlist(user_id, Some(&mut playlist_id), None);
assert!(playlists.is_ok());
}
None => assert!(false),
};
} | rust_cleaned_test_functions.jsonl/79294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3317,
69267,
368,
341,
262,
1077,
5206,
87790,
91193,
284,
40537,
57850,
486,
2258,
1005,
5834,
543,
262,
2432,
633,
6458,
2099,
6984,
87790,
91193,
8,
341,
286,
4329,
13274,
3109,
8,
589,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_valid_windows_1257_to_cow_without_bom_handling() {
let (cow, had_errors) = WINDOWS_1257.decode_without_bom_handling(b"abc\x80\xE4");
match cow {
Cow::Borrowed(_) => unreachable!(),
Cow::Owned(s) => {
assert_eq!(s, "abc\u{20AC}\u{00E4}");
}
}
assert!(!had_errors);
} | rust_cleaned_test_functions.jsonl/90258 | {
"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,
15227,
8337,
58220,
62,
16,
17,
20,
22,
2346,
666,
363,
39904,
880,
316,
75642,
368,
341,
286,
1077,
320,
18921,
11,
1030,
20196,
8,
284,
75165,
62,
16,
17,
20,
22,
15922,
39904,
880,
316,
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... | 2 |
#[test]
fn test_send_messages_dump_db() {
let client = RpcClient::new_mock("mock_client".to_string());
let dir = tempdir().unwrap();
let db_file = dir
.path()
.join("send_messages.db")
.to_str()
.unwrap()
.to_string();
let mut db = db::open_db(&db_file, false).unwrap();
let sender = Keypair::new();
let recipient = Pubkey::new_unique();
let amount = sol_to_lamports(1.0);
let last_valid_slot = 222;
let transaction = transfer(&client, amount, &sender, &recipient).unwrap();
// Queue db data
db::set_transaction_info(
&mut db,
&recipient,
amount,
&transaction,
None,
false,
last_valid_slot,
None,
)
.unwrap();
// Check that data has not been dumped
let read_db = db::open_db(&db_file, true).unwrap();
assert!(db::read_transaction_infos(&read_db).is_empty());
// This is just dummy data; Args will not affect messages
let args = DistributeTokensArgs {
sender_keypair: Box::new(Keypair::new()),
fee_payer: Box::new(Keypair::new()),
dry_run: true,
input_csv: "".to_string(),
transaction_db: "".to_string(),
output_path: None,
stake_args: None,
spl_token_args: None,
transfer_amount: None,
};
let allocation = Allocation {
recipient: recipient.to_string(),
amount: sol_to_lamports(1.0),
lockup_date: "".to_string(),
};
let message = transaction.message.clone();
// Exit false will not dump data
send_messages(
&client,
&mut db,
&[allocation.clone()],
&args,
Arc::new(AtomicBool::new(false)),
vec![message.clone()],
vec![(Keypair::new(), None)],
)
.unwrap();
let read_db = db::open_db(&db_file, true).unwrap();
assert!(db::read_transaction_infos(&read_db).is_empty());
// Grab that expected value to test successful dump
let num_records = db::read_transaction_infos(&db).len();
// Empty messages/allocations will not dump data
let exit = Arc::new(AtomicBool::new(true));
send_messages(&client, &mut db, &[], &args, exit.clone(), vec![], vec![]).unwrap();
let read_db = db::open_db(&db_file, true).unwrap();
assert!(db::read_transaction_infos(&read_db).is_empty());
// Message/allocation should prompt data dump at start of loop
send_messages(
&client,
&mut db,
&[allocation],
&args,
exit,
vec![message.clone()],
vec![(Keypair::new(), None)],
)
.unwrap_err();
let read_db = db::open_db(&db_file, true).unwrap();
let transaction_info = db::read_transaction_infos(&read_db);
assert_eq!(transaction_info.len(), num_records);
assert!(transaction_info.contains(&TransactionInfo {
recipient,
amount,
new_stake_account_address: None,
finalized_date: None,
transaction,
last_valid_slot,
lockup_date: None,
}));
assert!(transaction_info.contains(&TransactionInfo {
recipient,
amount,
new_stake_account_address: None,
finalized_date: None,
transaction: Transaction::new_unsigned(message),
last_valid_slot: std::u64::MAX,
lockup_date: None,
}));
// Next dump should write record written in last send_messages call
let num_records = db::read_transaction_infos(&db).len();
db.dump().unwrap();
let read_db = db::open_db(&db_file, true).unwrap();
let transaction_info = db::read_transaction_infos(&read_db);
assert_eq!(transaction_info.len(), num_records);
} | rust_cleaned_test_functions.jsonl/50200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2049
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
23428,
18296,
8685,
368,
341,
286,
1077,
2943,
284,
79961,
2959,
486,
931,
34134,
445,
16712,
8179,
3263,
983,
3904,
1423,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
543,
286,
1077,
292... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_page_check_options_in_check() {
let check = read_single_check("checks/tests/test5.json").unwrap();
let page: &Page = &check.clone().pages.unwrap()[0];
let options = page.options.clone().unwrap();
let cookies = options.cookies;
let headers = options.headers;
let history = MultiChecker::check_pages(&[check]);
assert_eq!(history.len(), 3);
assert!(headers.is_some());
assert!(cookies.is_some());
assert_eq!(cookies.unwrap().len(), 3);
} | rust_cleaned_test_functions.jsonl/80333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6129,
7200,
8743,
1243,
7200,
368,
341,
286,
1077,
1779,
284,
1349,
19487,
7200,
445,
49383,
62468,
12697,
20,
4323,
1827,
15454,
543,
286,
1077,
2150,
25,
609,
2665,
284,
609,
2028,
15997,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_til_zero() {
let input = "demo\u{0}second\u{0}";
let (f, rest) = match parse_c_string(input){
Ok((f, Some(rest))) => (f,rest),
_ => ("",""),
};
println!("{:?} {:?}", f, rest);
assert!(f == "demo");
assert!(rest == "second\u{0}");
} | rust_cleaned_test_functions.jsonl/72357 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
528,
321,
19359,
368,
341,
286,
1077,
1946,
284,
330,
25762,
3770,
90,
15,
92,
5569,
3770,
90,
15,
71612,
286,
1077,
320,
69,
11,
2732,
8,
284,
2432,
4715,
666,
3904,
5384,
1264,
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_statsd_client_histogram_duration_with_tags() {
let client = StatsdClient::from_sink("prefix", NopMetricSink);
let res = client
.histogram_with_tags("key", Duration::from_nanos(4096))
.with_tag("foo", "bar")
.with_tag_value("beta")
.try_send();
assert_eq!("prefix.key:4096|h|#foo:bar,beta", res.unwrap().as_metric_str());
} | rust_cleaned_test_functions.jsonl/10605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
68564,
25454,
6615,
16333,
368,
341,
286,
1077,
2943,
284,
29927,
67,
2959,
486,
1499,
51567,
445,
11849,
497,
451,
453,
54310,
45094,
317,
286,
1077,
592,
284,
2943,
198,
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_reshape() -> Result<()> {
let s = Series::new("a", &[1, 2, 3, 4]);
for (dims, list_len) in [
(&[-1, 1], 4),
(&[4, 1], 4),
(&[2, 2], 2),
(&[-1, 2], 2),
(&[2, -1], 2),
] {
let out = s.reshape(dims)?;
assert_eq!(out.len(), list_len);
assert!(matches!(out.dtype(), DataType::List(_)));
assert_eq!(out.explode()?.len(), 4);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/55645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16137,
368,
1464,
5714,
71698,
341,
286,
1077,
274,
284,
11131,
486,
931,
445,
64,
497,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
10149,
286,
369,
320,
54490,
11,
1140,
6043,
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... | 4 |
#[test]
fn test_gray_f32() {
test_image_sum_f32("gradient-1c-32b-float.tiff", ColorType::Gray(32), 128.03194);
} | rust_cleaned_test_functions.jsonl/75194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 60
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51331,
761,
18,
17,
368,
341,
262,
1273,
4954,
10160,
761,
18,
17,
445,
26394,
12,
16,
66,
12,
18,
17,
65,
2220,
1239,
734,
3092,
497,
3478,
929,
486,
28174,
7,
18,
17,
701,
220,
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 |
#[test]
fn test_linuxcontainer_oci_state() {
let ret = new_linux_container_and_then(|c: LinuxContainer| c.oci_state());
assert!(ret.is_ok(), "Expecting Ok, Got {:?}", ret);
} | rust_cleaned_test_functions.jsonl/16624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77463,
3586,
62,
2119,
4387,
368,
341,
286,
1077,
2112,
284,
501,
77463,
15847,
8378,
68367,
22428,
66,
25,
14340,
4502,
91,
272,
13,
2119,
4387,
1423,
286,
2060,
10297,
2122,
2079,
19817,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_valign() {
let c = TableCellProperty::new().vertical_align(VAlignType::Center);
let b = c.build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:tcPr><w:vAlign w:val="center" /></w:tcPr>"#
);
} | rust_cleaned_test_functions.jsonl/22962 | {
"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,
6189,
622,
368,
341,
286,
1077,
272,
284,
84370,
3052,
486,
931,
1005,
15292,
37015,
12410,
10069,
929,
486,
9392,
317,
286,
1077,
293,
284,
272,
13239,
543,
286,
2060,
10714,
33673,
310,
607,
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_nonnull_array_is_not_null() {
let a = Int32Array::from_slice(&[1, 2, 3, 4]);
let res = is_not_null(&a);
let expected = BooleanArray::from_slice(vec![true, true, true, true]);
assert_eq!(expected, res);
} | rust_cleaned_test_functions.jsonl/36455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
2921,
3858,
6892,
7913,
15162,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
26488,
2099,
58,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
10149,
286,
1077,
592,
284,
37... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_http_request_chunked_payload() {
let mut buf = BytesMut::from(
"GET /test HTTP/1.1\r\n\
transfer-encoding: chunked\r\n\r\n",
);
let mut reader = MessageDecoder::<Request>::default();
let (req, pl) = reader.decode(&mut buf).unwrap().unwrap();
let mut pl = pl.unwrap();
assert!(req.chunked().unwrap());
buf.extend(b"4\r\ndata\r\n4\r\nline\r\n0\r\n\r\n");
assert_eq!(
pl.decode(&mut buf).unwrap().unwrap().chunk().as_ref(),
b"data"
);
assert_eq!(
pl.decode(&mut buf).unwrap().unwrap().chunk().as_ref(),
b"line"
);
assert!(pl.decode(&mut buf).unwrap().unwrap().eof());
} | rust_cleaned_test_functions.jsonl/22286 | {
"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,
25888,
7893,
30539,
291,
32813,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
1499,
1006,
310,
330,
3806,
608,
1944,
10130,
14,
16,
13,
16,
12016,
1699,
5661,
1797,
8317,
12,
17159,
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_from_cow_str() {
assert_eq!(String::from(Cow::Borrowed("string")), "string");
assert_eq!(String::from(Cow::Owned(String::from("string"))), "string");
} | rust_cleaned_test_functions.jsonl/3157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
666,
363,
2895,
368,
341,
262,
2060,
10714,
10297,
703,
486,
1499,
3025,
363,
486,
33,
7768,
291,
445,
917,
35674,
330,
917,
797,
262,
2060,
10714,
10297,
703,
486,
1499,
3025,
363,
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 |
#[test]
fn test_struct_array_builder() {
let boolean_data = ArrayData::builder(DataType::Boolean)
.len(4)
.add_buffer(Buffer::from([false, false, true, true].to_byte_slice()))
.build();
let int_data = ArrayData::builder(DataType::Int64)
.len(4)
.add_buffer(Buffer::from([42, 28, 19, 31].to_byte_slice()))
.build();
let mut field_types = vec![];
field_types.push(Field::new("a", DataType::Boolean, false));
field_types.push(Field::new("b", DataType::Int64, false));
let struct_array_data = ArrayData::builder(DataType::Struct(field_types))
.len(4)
.add_child_data(boolean_data.clone())
.add_child_data(int_data.clone())
.build();
let struct_array = StructArray::from(struct_array_data);
assert_eq!(boolean_data, struct_array.column(0).data());
assert_eq!(int_data, struct_array.column(1).data());
} | rust_cleaned_test_functions.jsonl/11632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
3858,
28532,
368,
341,
286,
1077,
2710,
1769,
284,
2910,
1043,
486,
17850,
63941,
486,
6890,
340,
310,
659,
2892,
7,
19,
340,
310,
659,
718,
7776,
55574,
486,
1499,
2561,
3849,
11,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_gather_scalar_index() {
let data = Tensor::from(arr1(&[1i64, 2, 3]));
let gatherer = Gather::new(0);
for idx in 2..3 {
let index = Tensor::from(arr0(idx as i64));
let outputs = gatherer.eval(tvec![data.clone().into(), index.into()]).unwrap();
let output = &outputs[0];
assert_eq!(output.shape().len(), 0);
assert_eq!(*output.to_scalar::<i64>().unwrap(), idx + 1);
}
} | rust_cleaned_test_functions.jsonl/32385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
1889,
1856,
41652,
3560,
368,
341,
286,
1077,
821,
284,
26036,
486,
1499,
10939,
16,
2099,
58,
16,
72,
21,
19,
11,
220,
17,
11,
220,
18,
14382,
286,
1077,
9567,
261,
284,
48995,
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... | 2 |
#[test]
fn test_integer_underflow() {
let resp_object = RespValue::Integer(-2);
let res = u64::from_resp(resp_object);
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/22229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31725,
58228,
4965,
368,
341,
286,
1077,
9039,
5314,
284,
79786,
1130,
486,
3486,
4080,
17,
317,
286,
1077,
592,
284,
575,
21,
19,
486,
1499,
35160,
20267,
5314,
317,
286,
2060,
10297,
416,
2079... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_reverse_iterate_with_lower_bound() {
let path = TempDir::new("test-raftstore").unwrap();
let engines = new_temp_engine(&path);
let (store, test_data) = load_default_dataset(engines);
let snap = RegionSnapshot::new(&store);
let mut iter_opt = IterOption::default();
iter_opt.set_lower_bound(b"a3".to_vec());
let mut iter = snap.iter(iter_opt);
assert!(iter.seek_to_last());
let mut res = vec![];
loop {
res.push((iter.key().to_vec(), iter.value().to_vec()));
if !iter.prev() {
break;
}
}
res.sort();
assert_eq!(res, test_data[1..3].to_vec());
} | rust_cleaned_test_functions.jsonl/7200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43277,
11723,
349,
6615,
30425,
19447,
368,
341,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
445,
1944,
12,
2944,
4314,
1827,
15454,
543,
286,
1077,
21106,
284,
501,
11771,
24823,
2099,
2343,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_mutable_extend_from_slice() {
let mut buf = MutableBuffer::new(100);
buf.extend_from_slice(b"hello");
assert_eq!(5, buf.len());
assert_eq!(b"hello", buf.data());
buf.extend_from_slice(b" world");
assert_eq!(11, buf.len());
assert_eq!(b"hello world", buf.data());
buf.clear();
assert_eq!(0, buf.len());
buf.extend_from_slice(b"hello arrow");
assert_eq!(11, buf.len());
assert_eq!(b"hello arrow", buf.data());
} | rust_cleaned_test_functions.jsonl/54334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
5922,
70265,
5673,
26488,
368,
341,
286,
1077,
5206,
6607,
284,
31143,
4095,
486,
931,
7,
16,
15,
15,
317,
286,
6607,
15831,
5673,
26488,
1883,
1,
14990,
797,
286,
2060,
10714,
10297,
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_full_node_basic_flow() {
// launch environment of 4 validator nodes and 2 full nodes
let mut env = TestEnvironment::new(4);
env.setup_full_node_swarm(2);
env.launch_swarm(RoleType::Validator);
env.launch_swarm(RoleType::FullNode);
// execute smoke script
test_smoke_script(env.get_validator_ac_client(0));
// read state from full node client
let mut validator_ac_client = env.get_validator_ac_client(1);
let mut full_node_client = env.get_full_node_ac_client(1);
for idx in 0..2 {
validator_ac_client.create_next_account(false).unwrap();
full_node_client.create_next_account(false).unwrap();
assert_eq!(
validator_ac_client
.get_balance(&["b", &idx.to_string()])
.unwrap(),
full_node_client
.get_balance(&["b", &idx.to_string()])
.unwrap(),
);
}
// writes through full node AC are disabled for now
let mint_result = full_node_client.mint_coins(&["mintb", "0", "1"], true);
assert!(mint_result.is_err());
} | rust_cleaned_test_functions.jsonl/106071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 493
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
5084,
34729,
27441,
368,
341,
262,
442,
7050,
4573,
315,
220,
19,
22935,
7798,
323,
220,
17,
2480,
7798,
198,
262,
1077,
5206,
6105,
284,
3393,
12723,
486,
931,
7,
19,
317,
262,
6105,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_entry_product_relation() {
let rng = &mut ark_std::test_rng();
let n = 1000usize;
let v = (0..n).map(|_| F::rand(rng)).collect::<Vec<_>>();
let monic_v = monic(&v);
let rrot_v = right_rotation(&monic_v);
let acc_v = accumulated_product(&monic_v);
let nm_rrot_v = right_rotation(&v);
let nm_acc_v = accumulated_product(&v);
let entry_product = monic_v.iter().product::<F>();
let chal = F::one();
let twist = powers(chal, rrot_v.len());
let lhs = ip(&hadamard(&rrot_v, &twist), &acc_v);
assert_eq!(
lhs,
chal * evaluate_le(&nm_acc_v, &chal) + entry_product + chal.pow(&[nm_acc_v.len() as u64]) * (chal - F::one())
);
} | rust_cleaned_test_functions.jsonl/98979 | {
"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,
9078,
9840,
46984,
368,
341,
262,
1077,
28422,
284,
609,
6984,
55217,
15656,
486,
1944,
66849,
543,
262,
1077,
308,
284,
220,
16,
15,
15,
15,
51878,
280,
262,
1077,
348,
284,
320,
15,
496,
77,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accountsdb_scan_multiple_account_storage_no_bank_one_slot() {
solana_logger::setup();
let slot_expected: Slot = 0;
let tf = crate::append_vec::test_utils::get_append_vec_path(
"test_accountsdb_scan_account_storage_no_bank",
);
let write_version1 = 0;
let write_version2 = 1;
let pubkey1 = solana_sdk::pubkey::new_rand();
let pubkey2 = solana_sdk::pubkey::new_rand();
for swap in [false, true].iter() {
let mut storages = [
sample_storage_with_entries(&tf, write_version1, slot_expected, &pubkey1)
.remove(0)
.remove(0),
sample_storage_with_entries(&tf, write_version2, slot_expected, &pubkey2)
.remove(0)
.remove(0),
];
if *swap {
storages[..].swap(0, 1);
}
let calls = AtomicU64::new(0);
let scan_func = |loaded_account: LoadedAccount, accum: &mut Vec<u64>, slot: Slot| {
calls.fetch_add(1, Ordering::Relaxed);
let write_version = loaded_account.write_version();
let first = loaded_account.pubkey() == &pubkey1 && write_version == write_version1;
assert!(
first || loaded_account.pubkey() == &pubkey2 && write_version == write_version2
);
assert_eq!(slot_expected, slot);
if first {
assert!(accum.is_empty());
} else {
assert!(accum.len() == 1);
}
accum.push(write_version);
};
let mut accum = Vec::new();
AccountsDb::scan_multiple_account_storages_one_slot(
&storages,
&scan_func,
slot_expected,
&mut accum,
);
assert_eq!(calls.load(Ordering::Relaxed), storages.len() as u64);
assert_eq!(accum, vec![write_version1, write_version2]);
}
} | rust_cleaned_test_functions.jsonl/1333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
28857,
45233,
13500,
23310,
6536,
35733,
11667,
27563,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
9446,
32190,
25,
31316,
284,
220,
15,
280,
286,
1077,
6409,
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... | 7 |
#[test]
fn test_uniform_graph_distribution() {
let nodes = 4;
let edges = 2;
let distribution = UniformGraphDistribution::new(nodes, edges).unwrap();
let mut rng = thread_rng();
let mut edge_buckets = vec![vec![0; nodes]; nodes];
for _ in 0..10000 {
let graph = distribution.sample(&mut rng);
assert_eq!(graph.node_count(), nodes);
assert_eq!(graph.edge_count(), edges);
for edge in graph.edge_references() {
let src_index = edge.source().index();
let tgt_index = edge.target().index();
// Graph has no self loops
assert_ne!(src_index, tgt_index);
edge_buckets[src_index][tgt_index] += 1;
}
}
let minimum_bucket_size = edge_buckets
.iter()
.enumerate()
.map(|(index, inner_bucket)| {
inner_bucket
.iter()
.enumerate()
.filter(|(inner_index, _)| *inner_index != index)
.min()
.unwrap()
.clone()
})
.map(|(_, inner_min)| *inner_min)
.min()
.unwrap();
let maximum_bucket_size = edge_buckets
.iter()
.enumerate()
.map(|(index, inner_bucket)| {
inner_bucket
.iter()
.enumerate()
.filter(|(inner_index, _)| *inner_index != index)
.max()
.unwrap()
.clone()
})
.map(|(_, inner_max)| *inner_max)
.max()
.unwrap();
// TODO: use the power of mathematics to determine the probability of obtaiing
let relative_delta =
((maximum_bucket_size - minimum_bucket_size) as f32) / (minimum_bucket_size as f32);
assert!(relative_delta < 0.10);
} | rust_cleaned_test_functions.jsonl/97719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45066,
14738,
41465,
368,
341,
286,
1077,
7798,
284,
220,
19,
280,
286,
1077,
12822,
284,
220,
17,
401,
286,
1077,
7982,
284,
47889,
11212,
62377,
486,
931,
38705,
11,
12822,
568,
15454,
543,
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_mld_immediate_report() {
// MLD specific part is mostly passthrough. This test case is here
// host should send the report immediately instead of setting a timer.
let mut s = MldGroupState::default();
let mut rng = new_rng(0);
s.join_group(&mut rng, Instant::now());
let actions = s.query_received(&mut rng, Duration::from_secs(0), Instant::now());
let vec = actions.into_iter().collect::<Vec<Action<_>>>();
assert_eq!(vec.len(), 2);
assert_eq!(vec[0], Action::Generic(GmpAction::SendReport(MldProtocolSpecific)));
assert_eq!(vec[1], Action::Specific(ImmediateIdleState));
} | rust_cleaned_test_functions.jsonl/123212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
507,
17895,
14636,
14813,
368,
341,
1789,
286,
442,
386,
12335,
3151,
949,
374,
10008,
6368,
86901,
13,
1096,
1273,
1142,
374,
1588,
79133,
286,
442,
3468,
1265,
3624,
279,
1895,
7069,
4518,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_put_user() {
run_test(|url, client| {
let login =
create_and_authorize_user(url, &client, "test_put_user@gmail.com", "Admin2193!");
let put_user_response = client
.put(&format!("{}/biome/users/{}", url, login.user_id))
.header("Authorization", format!("Bearer {}", login.token))
.json(&PutUser {
username: "test_put_user@gmail.com".to_string(),
hashed_password: "Admin2193!".to_string(),
new_password: Some("new_password2193!".to_string()),
new_key_pairs: Vec::new(),
})
.send()
.unwrap();
assert_eq!(put_user_response.status().as_u16(), 200);
let login_response = client
.post(&format!("{}/biome/login", url))
.json(&UsernamePassword {
username: "test_put_user@gmail.com".to_string(),
hashed_password: "new_password2193!".to_string(),
})
.send()
.unwrap();
assert_eq!(login_response.status().as_u16(), 200);
})
} | rust_cleaned_test_functions.jsonl/32289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 688
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
3317,
368,
341,
286,
1598,
4452,
22428,
1085,
11,
2943,
91,
341,
310,
1077,
5858,
4035,
394,
1855,
8378,
22938,
551,
3317,
6522,
11,
609,
2972,
11,
330,
1944,
15557,
3317,
10375,
905,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul_scalar_saturating() {
let a = Primitive::from(&vec![None, Some(6), None, Some(6)]).to(DataType::Int32);
let result = saturating_mul_scalar(&a, &1i32);
let expected = Primitive::from(&vec![None, Some(6), None, Some(6)]).to(DataType::Int32);
assert_eq!(result, expected);
let a = Primitive::from(&vec![Some(-100i8)]).to(DataType::Int8);
let result = saturating_mul_scalar(&a, &100i8);
let expected = Primitive::from(&vec![Some(-128)]).to(DataType::Int8);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/12708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
41652,
643,
2628,
1095,
368,
341,
286,
1077,
264,
284,
51460,
486,
1499,
2099,
4083,
20703,
4064,
11,
4329,
7,
21,
701,
2240,
11,
4329,
7,
21,
7252,
568,
983,
63941,
486,
1072,
18,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_access() {
assert_eq!("drwxr-xr-x", pretty_access(S_IFDIR | 0o755));
assert_eq!("-rw-r--r--", pretty_access(S_IFREG | 0o644));
assert_eq!("srw-r-----", pretty_access(S_IFSOCK | 0o640));
assert_eq!("lrw-r-xr-x", pretty_access(S_IFLNK | 0o655));
assert_eq!("?rw-r-xr-x", pretty_access(0o655));
assert_eq!("brwSr-xr-x",
pretty_access(S_IFBLK | S_ISUID as mode_t | 0o655));
assert_eq!("brwsr-xr-x",
pretty_access(S_IFBLK | S_ISUID as mode_t | 0o755));
assert_eq!("prw---sr--",
pretty_access(S_IFIFO | S_ISGID as mode_t | 0o614));
assert_eq!("prw---Sr--",
pretty_access(S_IFIFO | S_ISGID as mode_t | 0o604));
assert_eq!("c---r-xr-t",
pretty_access(S_IFCHR | S_ISVTX as mode_t | 0o055));
assert_eq!("c---r-xr-T",
pretty_access(S_IFCHR | S_ISVTX as mode_t | 0o054));
} | rust_cleaned_test_functions.jsonl/36728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 575
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12759,
368,
341,
286,
2060,
10714,
17223,
3612,
20984,
81,
6558,
81,
6558,
497,
5020,
12759,
3759,
19035,
12251,
760,
220,
15,
78,
22,
20,
20,
1106,
286,
2060,
10714,
0,
13645,
31768,
3795,
313,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_replacement_variables() {
let actual = parse_replacement_variables(
"https://deno.land/_vsc1/modules/${module}/v/${{version}}",
);
assert_eq!(actual.len(), 2);
assert!(actual.contains(&"module".to_owned()));
assert!(actual.contains(&"version".to_owned()));
} | rust_cleaned_test_functions.jsonl/57036 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1288,
16101,
28182,
368,
341,
262,
1077,
5042,
284,
4715,
1288,
16101,
28182,
1006,
414,
330,
2428,
1110,
5183,
78,
87627,
19632,
85,
2388,
16,
22903,
11254,
4352,
4472,
85,
11254,
90,
4366... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_non_admin_sender() {
// Set up dispatcher and mock sender
let sender = Box::new(MockNetworkSender::default());
let mut dispatcher = Dispatcher::new(sender.box_clone());
// Add circuit and service to splinter state
let circuit = Circuit::builder()
.with_id("alpha".into())
.with_auth(AuthorizationType::Trust)
.with_members(vec!["1234".into(), "5678".into()])
.with_roster(vec!["abc".into(), "def".into()])
.with_persistence(PersistenceType::Any)
.with_durability(DurabilityType::NoDurability)
.with_routes(RouteType::Any)
.with_circuit_management_type("admin_test_app".into())
.build()
.expect("Should have built a correct circuit");
let mut circuit_directory = CircuitDirectory::new();
circuit_directory.add_circuit("alpha".to_string(), circuit);
let state = Arc::new(RwLock::new(SplinterState::new(
"memory".to_string(),
circuit_directory,
)));
let handler = AdminDirectMessageHandler::new("1234".into(), state);
dispatcher.set_handler(CircuitMessageType::ADMIN_DIRECT_MESSAGE, Box::new(handler));
let mut direct_message = AdminDirectMessage::new();
direct_message.set_circuit("admin".into());
direct_message.set_sender("abc".into());
direct_message.set_recipient("admin::1234".into());
direct_message.set_payload(b"test".to_vec());
direct_message.set_correlation_id("random_corr_id".into());
let direct_bytes = direct_message.write_to_bytes().unwrap();
assert_eq!(
Ok(()),
dispatcher.dispatch(
"5678",
&CircuitMessageType::ADMIN_DIRECT_MESSAGE,
direct_bytes
)
);
let send_request = sender.sent().lock().unwrap().get(0).unwrap().clone();
assert_send_request(
send_request,
"5678",
CircuitMessageType::CIRCUIT_ERROR_MESSAGE,
|error_msg: CircuitError| {
assert_eq!(error_msg.get_service_id(), "abc");
assert_eq!(
error_msg.get_error(),
CircuitError_Error::ERROR_SENDER_NOT_IN_CIRCUIT_ROSTER
);
assert_eq!(error_msg.get_correlation_id(), "random_corr_id");
},
)
} | rust_cleaned_test_functions.jsonl/111694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
21637,
12207,
54356,
368,
341,
286,
442,
2573,
705,
38799,
323,
7860,
4646,
198,
286,
1077,
4646,
284,
8261,
486,
931,
66436,
12320,
20381,
486,
2258,
1423,
286,
1077,
5206,
38799,
284,
589... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enum_long_values() {
with_key!(key, "EnumLongValues" => {
let mut vals = HashMap::with_capacity(3);
for i in &[5500, 9500, 15000] {
let name: String = format!("val{}", i);
let val = RegValue { vtype: REG_BINARY, bytes: (0..*i).map(|_| rand::random::<u8>()).collect() };
vals.insert(name, val);
}
for (name, val) in key.enum_values()
.map(|x| x.unwrap())
{
assert_eq!(val.bytes, vals[&name].bytes);
}
});
} | rust_cleaned_test_functions.jsonl/128097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
17799,
9146,
368,
341,
262,
448,
3097,
10297,
792,
11,
330,
10766,
6583,
6227,
1,
589,
341,
286,
1077,
5206,
28356,
284,
10528,
486,
4197,
35603,
7,
18,
626,
286,
369,
600,
304,
44590,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_merge_simple() {
let list = vec![Path::new("a/b/c")];
let (mut items, paths) =
FileTreeItems::create_items(&list, &BTreeSet::new())
.unwrap();
assert_eq!(items.len(), 3);
FileTreeItems::fold_paths(&mut items, &paths);
assert_eq!(items.len(), 2);
} | rust_cleaned_test_functions.jsonl/129801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
30015,
368,
341,
197,
10217,
1140,
284,
7486,
20703,
1820,
486,
931,
445,
64,
3470,
2899,
899,
935,
197,
10217,
320,
6984,
3589,
11,
12716,
8,
4035,
298,
24848,
6533,
4353,
486,
3182,
121... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let mut r = Register::new();
let mut b = MockBus::new();
r.set_A(0x40);
b.memory[0x80] = 0x40;
bit(0x80, &mut r, &mut b);
assert_eq!(r.get_status_zero(), false);
assert_eq!(r.get_status_negative(), false);
assert_eq!(r.get_status_overflow(), true)
} | rust_cleaned_test_functions.jsonl/14200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
1077,
5206,
293,
284,
14563,
15073,
486,
931,
543,
262,
435,
980,
1566,
7,
15,
87,
19,
15,
317,
262,
293,
36611,
58,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pv_protected_method() {
let hdr = indoc! {"
#include <cstdint>
class Observer {
public:
Observer() {}
virtual void foo() const {}
virtual ~Observer() {}
protected:
virtual void baz() const {}
};
inline void bar() {}
"};
run_test_ex(
"",
hdr,
quote! {
let obs = MyObserver::new_rust_owned(MyObserver { a: 3, cpp_peer: Default::default() });
obs.borrow().foo();
},
quote! {
generate!("bar")
subclass!("Observer",MyObserver)
},
None,
None,
Some(quote! {
use autocxx::subclass::CppSubclass;
use ffi::Observer_methods;
#[autocxx::subclass::subclass]
pub struct MyObserver {
a: u32
}
impl Observer_methods for MyObserver {
fn baz(&self) {
}
fn foo(&self) {
use ffi::Observer_supers;
self.baz_super()
}
}
}),
);
} | rust_cleaned_test_functions.jsonl/9950 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 653
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91139,
22357,
1569,
9032,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
671,
997,
366,
96975,
1339,
262,
536,
34041,
341,
262,
584,
510,
286,
34041,
368,
5613,
286,
4108,
737,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_str() {
let mut s = InlinableString::new();
for _ in 0..(INLINE_STRING_CAPACITY / 3) {
s.insert_str(0, "foo");
}
s.insert_str(0, "foo");
assert_eq!(
s,
String::from_iter((0..(INLINE_STRING_CAPACITY / 3) + 1).map(|_| "foo"))
);
} | rust_cleaned_test_functions.jsonl/109710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
2895,
368,
341,
286,
1077,
5206,
274,
284,
758,
3732,
480,
703,
486,
931,
1428,
286,
369,
716,
304,
220,
15,
496,
7,
55737,
12283,
92153,
608,
220,
18,
8,
341,
310,
274,
7030,
2895,
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... | 2 |
#[test]
fn test_column_writer_boolean_type_does_not_support_dictionary() {
let page_writer = get_test_page_writer();
let props = Arc::new(
WriterProperties::builder()
.set_dictionary_enabled(true)
.build(),
);
let mut writer = get_test_column_writer::<BoolType>(page_writer, 0, 0, props);
writer
.write_batch(&[true, false, true, false], None, None)
.unwrap();
let (bytes_written, rows_written, metadata) = writer.close().unwrap();
// byte.
assert_eq!(bytes_written, 1);
assert_eq!(rows_written, 4);
assert_eq!(metadata.encodings(), &vec![Encoding::PLAIN, Encoding::RLE]);
assert_eq!(metadata.num_values(), 4); // just values
assert_eq!(metadata.dictionary_page_offset(), None);
} | rust_cleaned_test_functions.jsonl/54347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
28908,
46642,
1819,
96374,
7913,
25827,
42605,
368,
341,
286,
1077,
2150,
28908,
284,
633,
4452,
6129,
28908,
543,
286,
1077,
6914,
284,
19689,
486,
931,
1006,
310,
29404,
7903,
486,
17850,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dead_fork_entry_verification_failure() {
let keypair2 = Keypair::new();
let res = check_dead_fork(|genesis_keypair, bank| {
let blockhash = bank.last_blockhash();
let slot = bank.slot();
let bad_hash = hash(&[2; 30]);
let hashes_per_tick = bank.hashes_per_tick().unwrap_or(0);
let entry = entry::next_entry(
// Use wrong blockhash so that the entry causes an entry verification failure
&bad_hash,
hashes_per_tick.saturating_sub(1),
vec![system_transaction::transfer(
genesis_keypair,
&keypair2.pubkey(),
2,
blockhash,
)],
);
entries_to_test_shreds(vec![entry], slot, slot.saturating_sub(1), false, 0)
});
if let Err(BlockstoreProcessorError::InvalidBlock(block_error)) = res {
assert_eq!(block_error, BlockError::InvalidEntryHash);
} else {
panic!();
}
} | rust_cleaned_test_functions.jsonl/11047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 578
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53427,
761,
669,
9078,
84245,
43618,
368,
341,
286,
1077,
1376,
12670,
17,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
592,
284,
1779,
53427,
761,
669,
22428,
77894,
3097,
12670,
11,
6073,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_deep_yield_with_type_error() {
let mut g = Gn::<()>::new(|| {
let mut g = Gn::<()>::new(|| {
yield_with(0);
});
g.next();
});
g.next();
} | rust_cleaned_test_functions.jsonl/91414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87044,
83709,
6615,
1819,
4096,
368,
341,
262,
1077,
5206,
342,
284,
95151,
27638,
368,
6831,
931,
79453,
341,
286,
1077,
5206,
342,
284,
95151,
27638,
368,
6831,
931,
79453,
341,
310,
7540,
6615,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dp_results() {
let dp_results = knap_01_dp(ITEMS, 400);
let dp_weights= dp_results.iter().fold(0, |a, &b| a + b.weight);
let dp_values = dp_results.iter().fold(0, |a, &b| a + b.value);
assert_eq!(dp_weights, 396);
assert_eq!(dp_values, 1030);
} | rust_cleaned_test_functions.jsonl/4929 | {
"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,
53872,
13576,
368,
341,
262,
1077,
11329,
13576,
284,
1148,
391,
62,
15,
16,
53872,
7,
11969,
50,
11,
220,
19,
15,
15,
317,
262,
1077,
11329,
21114,
28,
11329,
13576,
19471,
1005,
19961,
7,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_supported_cpuid() {
let kvm = KvmContext::new().unwrap();
let vm = Vm::new(kvm.fd()).expect("Cannot create new vm");
let cpuid = kvm
.kvm
.get_supported_cpuid(MAX_KVM_CPUID_ENTRIES)
.expect("Cannot get supported cpuid");
assert_eq!(vm.supported_cpuid().as_slice(), cpuid.as_slice());
} | rust_cleaned_test_functions.jsonl/1913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
57885,
39811,
2423,
368,
341,
286,
1077,
94748,
284,
730,
7338,
1972,
486,
931,
1005,
15454,
543,
286,
1077,
10995,
284,
647,
76,
486,
931,
5969,
7338,
58339,
6011,
17119,
445,
17444,
1855,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exact_chunks_mut_remainder() {
let v: &mut [i32] = &mut [0, 1, 2, 3, 4];
let c = v.exact_chunks_mut(2);
assert_eq!(c.into_remainder(), &[4]);
} | rust_cleaned_test_functions.jsonl/8457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71084,
65470,
29523,
86607,
1107,
368,
341,
262,
1077,
348,
25,
609,
6984,
508,
72,
18,
17,
60,
284,
609,
6984,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
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... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.