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_read_header_error() {
let data = &[0xff, 0, 0, 0, 0, 0, 0, 0];
let header = IppHeader::from_reader(&mut Cursor::new(data));
assert!(header.is_err());
if let Some(ParseError::InvalidVersion) = header.err() {
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/127283 | {
"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,
6443,
8757,
4096,
368,
341,
286,
1077,
821,
284,
44590,
15,
9020,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
4821,
286,
1077,
4247,
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... | 2 |
#[test]
fn test_random_shuffle_two_runs_not_the_same() {
for arg in ["-R", "-k1,1R"] {
// check to verify that two random shuffles are not equal; this has the
// potential to fail in the very unlikely event that the random order is the same
const FILE: &str = "default_unsorted_ints.expected";
let (at, _ucmd) = at_and_ucmd!();
let result = new_ucmd!().arg(arg).arg(FILE).run().stdout_move_str();
let expected = at.read(FILE);
let unexpected = new_ucmd!().arg(arg).arg(FILE).run().stdout_move_str();
assert_ne!(result, expected);
assert_ne!(result, unexpected);
}
} | rust_cleaned_test_functions.jsonl/20464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
73484,
23241,
67352,
7913,
16068,
33574,
368,
341,
262,
369,
1392,
304,
4383,
12,
49,
497,
6523,
74,
16,
11,
16,
49,
1341,
341,
286,
442,
1779,
311,
10146,
429,
1378,
4194,
557,
77453,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nonnull_array_is_not_null() {
let a = Int32Array::from(vec![1, 2, 3, 4]);
let res = is_not_null(&a).unwrap();
let expected = BooleanArray::from(vec![true, true, true, true]);
assert_eq!(expected, res);
assert_eq!(&None, res.data_ref().null_bitmap());
} | rust_cleaned_test_functions.jsonl/45024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
2921,
3858,
6892,
7913,
15162,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
10149,
286,
1077,
592,
284,
374,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_or_insert() {
let mut zone = UnSafeRBTreeStorage::default();
let node = zone
.find_or_insert(&DNSName::new("www.baidu.com.", None).unwrap())
.unwrap();
assert_eq!(node.borrow().label, Label::from_str("www").unwrap());
assert_eq!(
node.borrow().get_name(),
DNSName::new("www.baidu.com.", None).unwrap()
);
} | rust_cleaned_test_functions.jsonl/29051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
8734,
17678,
368,
341,
286,
1077,
5206,
10143,
284,
1230,
25663,
29259,
6533,
5793,
486,
2258,
543,
286,
1077,
2436,
284,
10143,
198,
310,
659,
3903,
8734,
17678,
2099,
61088,
675,
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_send_next_data() {
fn expect_chunk(expected: &[u8], frame: &HttpFrame) {
let frame = match frame {
&HttpFrame::DataFrame(ref frame) => frame,
_ => panic!("Expected a data frame"),
};
assert_eq!(expected, &frame.data[..]);
}
let mut conn = build_mock_http_conn();
let mut sender = MockSendFrame::new();
let chunks = vec![
vec![1, 2, 3, 4],
vec![5, 6],
vec![7],
vec![],
];
let mut prioritizer = StubDataPrioritizer::new(chunks.clone());
let mut expected_window = 65_535;
assert_eq!(conn.out_window_size(), expected_window);
// Send as many chunks as we've given the prioritizer
for chunk in chunks.iter() {
assert_eq!(SendStatus::Sent,
conn.sender(&mut sender).send_next_data(&mut prioritizer).unwrap());
let last = sender.sent.pop().unwrap();
expect_chunk(&chunk, &HttpFrame::from_raw(&last).unwrap());
expected_window -= chunk.len() as i32;
assert_eq!(conn.out_window_size(), expected_window);
}
// Nothing to send any more
assert_eq!(SendStatus::Nothing,
conn.sender(&mut sender).send_next_data(&mut prioritizer).unwrap());
assert_eq!(conn.out_window_size(), expected_window);
} | rust_cleaned_test_functions.jsonl/131333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 713
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
11257,
1769,
368,
341,
286,
5168,
1720,
30539,
15253,
25,
44590,
84,
23,
1125,
4034,
25,
609,
2905,
4369,
8,
341,
310,
1077,
4034,
284,
2432,
4034,
341,
394,
609,
2905,
4369,
486,
98938,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_base_point_addition_and_doubling() {
let mut two = G2::one();
two.add_assign(&G2::one());
let one = G2::one();
let mut three21 = two;
three21.add_assign(&one);
let mut three12 = one;
three12.add_assign(&two);
assert_eq!(three12, three21);
} | rust_cleaned_test_functions.jsonl/14359 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7651,
6085,
2891,
680,
8378,
814,
283,
9695,
368,
341,
286,
1077,
5206,
1378,
284,
479,
17,
486,
603,
543,
286,
1378,
1364,
20688,
2099,
38,
17,
486,
603,
5231,
286,
1077,
825,
284,
479,
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_swp_opcode() {
let mut test_vm = VM::new();
test_vm.registers[1].content = 1; // dest register
test_vm.registers[2].content = 7; // bool source register
test_vm.registers[3].content = 1; // dest register ref
test_vm.registers[4].content = 2; // bool source register ref
test_vm.program = vec![13, 3, 4, 0];
test_vm.run_once();
assert_eq!(test_vm.registers[1].content, 7);
assert_eq!(test_vm.registers[2].content, 1);
} | rust_cleaned_test_functions.jsonl/60351 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
8421,
71319,
368,
341,
286,
1077,
5206,
1273,
39008,
284,
17792,
486,
931,
543,
286,
1273,
39008,
7031,
9303,
58,
16,
936,
1796,
284,
220,
16,
26,
442,
3201,
4161,
198,
286,
1273,
39008,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ternary_null() -> Result<()> {
let df = df![
"a" => ["a", "b", "c"]
]?;
let out = df
.lazy()
.select([when(col("a").eq(lit("c")))
.then(Null {}.lit())
.otherwise(col("a"))
.alias("foo")])
.collect()?;
assert_eq!(
out.column("foo")?.is_null().into_iter().collect::<Vec<_>>(),
&[Some(false), Some(false), Some(true)]
);
Ok(())
} | rust_cleaned_test_functions.jsonl/152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
4160,
658,
15162,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
284,
6764,
90515,
286,
330,
64,
1,
589,
4383,
64,
497,
330,
65,
497,
330,
66,
7026,
262,
2279,
69493,
262,
1077,
700,
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... | 4 |
#[test]
fn test_u64_elementwise_bytes_lt() {
proptest!(niters(2000), |(x in any::<u64>(), y in any::<u64>())| {
let x = x & 0x7f7f_7f7f_7f7f_7f7f_u64;
prop_assert_eq!(
u64_elementwise_bytes_lt_ref(x, y),
u64_elementwise_bytes_lt(x, y)
);
});
} | rust_cleaned_test_functions.jsonl/97282 | {
"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,
7300,
21,
19,
7894,
4482,
12524,
39164,
368,
341,
286,
462,
70334,
10297,
44068,
388,
7,
17,
15,
15,
15,
701,
760,
7,
87,
304,
894,
27638,
84,
21,
19,
39019,
379,
304,
894,
27638,
84,
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_create_sysvar_invalid_id_with_feature() {
// Attempt to create system account in account already owned by another program
let from = Pubkey::new_unique();
let from_account = AccountSharedData::new(100, 0, &system_program::id());
let to = Pubkey::new_unique();
let to_account = AccountSharedData::new(0, 0, &system_program::id());
process_instruction(
&bincode::serialize(&SystemInstruction::CreateAccount {
lamports: 50,
space: 2,
owner: sysvar::id(),
})
.unwrap(),
vec![(from, from_account), (to, to_account)],
vec![
AccountMeta {
pubkey: from,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: to,
is_signer: true,
is_writable: false,
},
],
Ok(()),
super::process_instruction,
);
} | rust_cleaned_test_functions.jsonl/95878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 627
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
20344,
947,
31433,
842,
6615,
17069,
368,
341,
286,
442,
43517,
311,
1855,
1849,
2692,
304,
2692,
2669,
12938,
553,
2441,
2025,
198,
286,
1077,
504,
284,
22611,
792,
486,
931,
21218,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_abbreviate_long_string() {
let mut out = ProcOutput::new();
let data = vec![b'.'; HEAD_LEN + TAIL_LEN + 16];
out.extend(&data, &[]);
let mut expected = vec![b'.'; HEAD_LEN];
expected.extend_from_slice(b"\n\n<<<<<< SKIPPED 16 BYTES >>>>>>\n\n");
expected.extend_from_slice(&vec![b'.'; TAIL_LEN]);
// `out` is hundreds of KBs in size.
let out = out.into_bytes();
assert_eq!(expected.len(), out.len());
assert_eq!(expected, out);
} | rust_cleaned_test_functions.jsonl/34994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
44272,
6493,
17799,
3904,
368,
341,
262,
1077,
5206,
700,
284,
41087,
5097,
486,
931,
1428,
262,
1077,
821,
284,
7486,
20703,
65,
6,
3159,
26,
33080,
15536,
488,
350,
5965,
15536,
488,
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_filter_ast() {
let ast: UserAST = ("super".into(), Or, ("cool".into(), Or, "fancy".into()).into()).into();
let ast = ast.filter_ast(
&mut |ast: &UserAST, _attr: Option<&str>| match ast {
UserAST::Leaf(filter) => filter.phrase == "cool",
_ => false,
},
None,
);
assert_eq!(ast, Some(("super".into(), Or, "fancy".into()).into()));
let ast: UserAST = parse("myattr:(super cool)").unwrap();
assert_eq!(ast.filter_ast(&mut |_ast, _attr| { true }, None), None);
assert_eq!(
ast.filter_ast(
&mut |ast, _attr| {
match ast {
UserAST::Leaf(filter) => filter.phrase == "cool",
_ => false,
}
},
None
),
Some(UserAST::Attributed("myattr".to_string(), "super".into()))
);
} | rust_cleaned_test_functions.jsonl/42780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 553
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
48019,
368,
341,
286,
1077,
11763,
25,
2657,
6349,
284,
3489,
9522,
3263,
18122,
1507,
2521,
11,
3489,
42196,
3263,
18122,
1507,
2521,
11,
330,
69,
6572,
3263,
18122,
6011,
18122,
6011,
1812... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_strip_ansi_codes_osc_hyperlink() {
assert_eq!(strip_ansi_codes("\x1b[38;5;4m\x1b]8;;file:///Users/dan/src/delta/src/ansi/mod.rs\x1b\\src/ansi/mod.rs\x1b]8;;\x1b\\\x1b[0m\n"),
"src/ansi/mod.rs\n");
} | rust_cleaned_test_functions.jsonl/49544 | {
"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,
66130,
62,
52067,
38482,
62,
23469,
93416,
2080,
368,
341,
286,
2060,
10714,
10297,
13105,
62,
52067,
38482,
4921,
87,
16,
65,
58,
18,
23,
26,
20,
26,
19,
76,
3462,
16,
65,
60,
23,
6768,
119... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exchange_local_cluster() {
solana_logger::setup();
const NUM_NODES: usize = 1;
let config = Config {
identity: Keypair::new(),
duration: Duration::from_secs(1),
fund_amount: 100_000,
threads: 1,
transfer_delay: 20,
batch_size: 100,
chunk_size: 10,
account_groups: 1,
..Config::default()
};
let Config {
fund_amount,
batch_size,
account_groups,
..
} = config;
let accounts_in_groups = batch_size * account_groups;
let cluster = LocalCluster::new(
&mut ClusterConfig {
node_stakes: vec![100_000; NUM_NODES],
cluster_lamports: 100_000_000_000_000,
validator_configs: make_identical_validator_configs(
&ValidatorConfig::default(),
NUM_NODES,
),
native_instruction_processors: [solana_exchange_program!()].to_vec(),
..ClusterConfig::default()
},
SocketAddrSpace::Unspecified,
);
let faucet_keypair = Keypair::new();
cluster.transfer(
&cluster.funding_keypair,
&faucet_keypair.pubkey(),
2_000_000_000_000,
);
let (addr_sender, addr_receiver) = channel();
run_local_faucet_with_port(faucet_keypair, addr_sender, Some(1_000_000_000_000), 0);
let faucet_addr = addr_receiver
.recv_timeout(Duration::from_secs(2))
.expect("run_local_faucet")
.expect("faucet_addr");
info!("Connecting to the cluster");
let nodes = discover_cluster(
&cluster.entry_point_info.gossip,
NUM_NODES,
SocketAddrSpace::Unspecified,
)
.unwrap_or_else(|err| {
error!("Failed to discover {} nodes: {:?}", NUM_NODES, err);
exit(1);
});
let (client, num_clients) = get_multi_client(&nodes, &SocketAddrSpace::Unspecified);
info!("clients: {}", num_clients);
assert!(num_clients >= NUM_NODES);
const NUM_SIGNERS: u64 = 2;
airdrop_lamports(
&client,
&faucet_addr,
&config.identity,
fund_amount * (accounts_in_groups + 1) as u64 * NUM_SIGNERS,
);
do_bench_exchange(vec![client], config);
} | rust_cleaned_test_functions.jsonl/24889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1094
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59212,
13564,
28441,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
733,
15943,
92948,
25,
22301,
284,
220,
16,
401,
262,
1077,
2193,
284,
5532,
341,
286,
9569,
25,
6569,
1082,
1310,
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_duplicates() {
let a = vec![1, 2, 3, 4, 5];
assert_eq!(a.iter().duplicates().next(), None);
let a = vec![1, 2, 1, 4, 5, 2, 1, 5];
assert_eq!(
a.into_iter().duplicates().collect::<Vec<_>>(),
vec![1, 2, 5]
);
} | rust_cleaned_test_functions.jsonl/91325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75051,
368,
341,
286,
1077,
264,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
2060,
10714,
10297,
64,
19471,
1005,
67,
40614,
1005,
3600,
1507,
2240,
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_reverse_iterate() {
let path = TempDir::new("test-raftstore").unwrap();
let engine = new_temp_engine(&path);
let (store, test_data) = load_default_dataset(engine.clone());
let snap = RegionSnapshot::new(&store);
let mut iter = Cursor::new(snap.iter(None, true), ScanMode::Mixed);
assert!(!iter.reverse_seek(&Key::from_encoded(b"a2".to_vec())).unwrap());
assert!(iter.reverse_seek(&Key::from_encoded(b"a7".to_vec())).unwrap());
let mut pair = (iter.key().to_vec(), iter.value().to_vec());
assert_eq!(pair, (b"a5".to_vec(), b"v5".to_vec()));
assert!(iter.reverse_seek(&Key::from_encoded(b"a5".to_vec())).unwrap());
pair = (iter.key().to_vec(), iter.value().to_vec());
assert_eq!(pair, (b"a3".to_vec(), b"v3".to_vec()));
assert!(!iter.reverse_seek(&Key::from_encoded(b"a3".to_vec())).unwrap());
assert!(iter.reverse_seek(&Key::from_encoded(b"a1".to_vec())).is_err());
assert!(iter.reverse_seek(&Key::from_encoded(b"a8".to_vec())).is_err());
assert!(iter.seek_to_last());
let mut res = vec![];
loop {
res.push((iter.key().to_vec(), iter.value().to_vec()));
if !iter.prev() {
break;
}
}
let mut expect = test_data[1..3].to_vec();
expect.reverse();
assert_eq!(res, expect);
// test last region
let mut region = Region::new();
region.mut_peers().push(Peer::new());
let store = new_peer_storage(engine.clone(), ®ion);
let snap = RegionSnapshot::new(&store);
let mut iter = Cursor::new(snap.iter(None, true), ScanMode::Mixed);
assert!(!iter.reverse_seek(&Key::from_encoded(b"a1".to_vec())).unwrap());
assert!(iter.reverse_seek(&Key::from_encoded(b"a2".to_vec())).unwrap());
let pair = (iter.key().to_vec(), iter.value().to_vec());
assert_eq!(pair, (b"a1".to_vec(), b"v1".to_vec()));
for kv_pairs in test_data.windows(2) {
let seek_key = Key::from_encoded(kv_pairs[1].0.clone());
assert!(iter.reverse_seek(&seek_key).unwrap(),
format!("{}", seek_key));
let pair = (iter.key().to_vec(), iter.value().to_vec());
assert_eq!(pair, kv_pairs[0]);
}
assert!(iter.seek_to_last());
let mut res = vec![];
loop {
res.push((iter.key().to_vec(), iter.value().to_vec()));
if !iter.prev() {
break;
}
}
let mut expect = test_data.clone();
expect.reverse();
assert_eq!(res, expect);
} | rust_cleaned_test_functions.jsonl/37249 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43277,
11723,
349,
368,
341,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
445,
1944,
12,
2944,
4314,
1827,
15454,
543,
286,
1077,
4712,
284,
501,
11771,
24823,
2099,
2343,
317,
286,
1077,
320,
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... | 4 |
#[test]
fn test_burn() {
let mut service = TestService::new();
let caller = TestService::caller();
let ctx = mock_context(caller.clone());
let asset = create_asset!(service, ctx.clone(), 10000, 10);
let asset_to_burn = BurnAssetPayload {
asset_id: asset.id.clone(),
amount: 100,
proof: Hex::from_string("0xaaBB".to_owned()).unwrap(),
memo: "".to_owned(),
};
service_call!(service, burn, ctx.clone(), asset_to_burn);
assert_eq!(ctx.get_events().len(), 2);
let event: BurnAssetEvent = serde_json::from_str(&ctx.get_events()[1].data).expect("event");
assert_eq!(event.asset_id, asset.id);
assert_eq!(event.from, caller);
assert_eq!(event.amount, 100);
let caller_balance = service_call!(service, get_balance, ctx.clone(), GetBalancePayload {
asset_id: asset.id.clone(),
user: caller,
});
assert_eq!(caller_balance.balance, asset.supply - 100);
let asset_ret = service_call!(service, get_asset, ctx, GetAssetPayload { id: asset.id });
assert_eq!(asset_ret.supply, 9900)
} | rust_cleaned_test_functions.jsonl/27234 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 467
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
399,
368,
341,
262,
1077,
5206,
2473,
284,
3393,
1860,
486,
931,
543,
262,
1077,
19865,
284,
3393,
1860,
486,
56126,
543,
262,
1077,
5635,
284,
7860,
8467,
1337,
13956,
15997,
1423,
262,
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_seq_set_item_refcnt() {
let obj = get_object();
{
let gil = Python::acquire_gil();
let py = gil.python();
let v: Vec<i32> = vec![1, 2];
let ob = v.to_object(py);
let seq = ob.cast_as::<PySequence>(py).unwrap();
assert!(seq.set_item(1, &obj).is_ok());
assert!(seq.get_item(1).unwrap().as_ptr() == obj.as_ptr());
}
{
let gil = Python::acquire_gil();
let py = gil.python();
assert_eq!(1, obj.get_refcnt(py));
}
} | rust_cleaned_test_functions.jsonl/47415 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
2602,
5634,
7793,
15853,
368,
341,
286,
1077,
2839,
284,
633,
5314,
543,
286,
341,
310,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
310,
1077,
4510,
284,
342,
321,
43193,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_real_as_json() {
test_none_with_ctx(cast_any_as_any::<Real, Json>);
let cs = vec![
(f64::from(f32::MAX), Json::Double(f64::from(f32::MAX))),
(f64::from(f32::MIN), Json::Double(f64::from(f32::MIN))),
(f64::MAX, Json::Double(f64::MAX)),
(f64::MIN, Json::Double(f64::MIN)),
];
for (input, expect) in cs {
let mut ctx = EvalContext::default();
let r = cast_any_as_any::<Real, Json>(&mut ctx, &Real::new(input).ok());
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/101815 | {
"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,
15266,
11898,
9455,
368,
341,
286,
1273,
31488,
6615,
15147,
1337,
559,
37248,
11898,
37248,
27638,
12768,
11,
8308,
29,
626,
286,
1077,
10532,
284,
7486,
90515,
310,
320,
69,
21,
19,
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_purge_huge() {
let blockstore_path = get_tmp_ledger_path!();
let blockstore = Blockstore::open(&blockstore_path).unwrap();
let (shreds, _) = make_many_slot_entries(0, 5000, 10);
blockstore.insert_shreds(shreds, None, false).unwrap();
blockstore.purge_and_compact_slots(0, 4999);
test_all_empty_or_min(&blockstore, 5000);
drop(blockstore);
Blockstore::destroy(&blockstore_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/38761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
39823,
1523,
4733,
368,
341,
286,
1077,
2504,
4314,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
2099,
4574,
4314,
2638,
568,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_min_int() {
// Unsigned
assert_eq!(min_int(8, false), BigInt::from(u8::MIN));
assert_eq!(min_int(16, false), BigInt::from(u16::MIN));
assert_eq!(min_int(32, false), BigInt::from(u32::MIN));
assert_eq!(min_int(64, false), BigInt::from(u64::MIN));
assert_eq!(min_int(128, false), BigInt::from(u128::MIN));
//Signed
assert_eq!(min_int(8, true), BigInt::from(i8::MIN));
assert_eq!(min_int(16, true), BigInt::from(i16::MIN));
assert_eq!(min_int(32, true), BigInt::from(i32::MIN));
assert_eq!(min_int(64, true), BigInt::from(i64::MIN));
assert_eq!(min_int(128, true), BigInt::from(i128::MIN));
} | rust_cleaned_test_functions.jsonl/55698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
4042,
368,
341,
286,
442,
97747,
198,
286,
2060,
10714,
10297,
1065,
4042,
7,
23,
11,
895,
701,
62608,
486,
1499,
8154,
23,
486,
16413,
1106,
286,
2060,
10714,
10297,
1065,
4042,
7,
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_put_vlq_int() {
let total = 64;
let mut writer = BitWriter::new(total * 32);
let values = random_numbers::<u32>(total);
(0..total).for_each(|i| {
assert!(
writer.put_vlq_int(values[i] as u64),
"[{}]; put_vlq_int() failed",
i
);
});
let mut reader = BitReader::from(writer.consume());
(0..total).for_each(|i| {
let v = reader
.get_vlq_int()
.expect("get_vlq_int() should return OK");
assert_eq!(
v as u32, values[i],
"[{}]: expected {} but got {}",
i, values[i], v
);
});
} | rust_cleaned_test_functions.jsonl/115744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
2273,
75,
80,
4042,
368,
341,
286,
1077,
2790,
284,
220,
21,
19,
280,
286,
1077,
5206,
6916,
284,
6495,
6492,
486,
931,
22842,
353,
220,
18,
17,
317,
286,
1077,
2750,
284,
4194,
32964,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_linkat_newdirfd_none() {
let _dr = ::DirRestore::new();
let tempdir_oldfile = tempfile::tempdir().unwrap();
let oldfilename = "foo.txt";
let oldfilepath = tempdir_oldfile.path().join(oldfilename);
let tempdir_newfile = tempfile::tempdir().unwrap();
let newfilename = "bar.txt";
let newfilepath = tempdir_newfile.path().join(newfilename);
// Create file
File::create(&oldfilepath).unwrap();
// Get file descriptor for base directory of old file
let dirfd = fcntl::open(tempdir_oldfile.path(), fcntl::OFlag::empty(), stat::Mode::empty()).unwrap();
// Attempt hard link file using current working directory as relative path for new file path
chdir(tempdir_newfile.path()).unwrap();
linkat(Some(dirfd), oldfilename, None, newfilename, LinkatFlags::SymlinkFollow).unwrap();
assert!(newfilepath.exists());
} | rust_cleaned_test_functions.jsonl/30616 | {
"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,
7233,
266,
5921,
3741,
6902,
31488,
368,
341,
262,
1077,
716,
3612,
284,
3504,
6184,
56284,
486,
931,
1428,
262,
1077,
2730,
3741,
21108,
1192,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug() {
assert_eq!(
format!("{:?}", Vector3D::new(3, 4, 5)),
"Vector<3>(3, 4, 5)"
);
} | rust_cleaned_test_functions.jsonl/21644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
310,
2060,
10714,
33673,
394,
3561,
88928,
25,
52652,
4196,
18,
35,
486,
931,
7,
18,
11,
220,
19,
11,
220,
20,
6965,
394,
330,
3781,
27,
18,
2235,
18,
11,
220,
19,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_serde_df() {
let s = Series::new("foo", &[1, 2, 3]);
let s1 = Series::new("bar", &[Some(true), None, Some(false)]);
let s_list = Series::new("list", &[s.clone(), s.clone(), s.clone()]);
let df = DataFrame::new(vec![s, s_list, s1]).unwrap();
let json = serde_json::to_string(&df).unwrap();
dbg!(&json);
let out = serde_json::from_str::<DataFrame>(&json).unwrap();
assert!(df.frame_equal_missing(&out));
} | rust_cleaned_test_functions.jsonl/49039 | {
"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,
75861,
450,
10894,
368,
341,
286,
1077,
274,
284,
11131,
486,
931,
445,
7975,
497,
44590,
16,
11,
220,
17,
11,
220,
18,
2558,
286,
1077,
274,
16,
284,
11131,
486,
931,
445,
2257,
497,
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... | 1 |
#[test]
fn test_recv_batch_timeout_nothing() {
futures::executor::block_on(async move {
let (_, mut receiver) = channel("data/recv-batch-timeout-nothing").unwrap();
assert!(receiver
.recv_batch_timeout(2, Delay::new(Duration::from_secs(1)))
.await
.unwrap()
.is_empty(),);
});
} | rust_cleaned_test_functions.jsonl/95826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36118,
14534,
20537,
6536,
1596,
368,
341,
286,
36823,
486,
80787,
486,
4574,
4470,
18285,
3271,
341,
310,
1077,
39464,
5206,
13964,
8,
284,
5496,
445,
691,
14,
33977,
1455,
754,
7246,
411,
28366,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dynamic_rmq() {
let mut arq = DynamicArq::<AssignMin>::new(false);
let view = arq.build_from_slice(&[0; 10]);
assert_eq!(arq.query(view, 0, 9), 0);
arq.modify(view, 2, 4, &-5);
arq.modify(view, 5, 7, &-3);
arq.modify(view, 1, 6, &1);
assert_eq!(arq.query(view, 0, 9), -3);
} | rust_cleaned_test_functions.jsonl/99604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45992,
1710,
27674,
368,
341,
286,
1077,
5206,
796,
80,
284,
21886,
6953,
80,
27638,
28933,
6217,
6831,
931,
3576,
317,
286,
1077,
1651,
284,
796,
80,
13239,
5673,
26488,
2099,
58,
15,
26,
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_protocol_size() {
let contact_info = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default()));
let dummy_vec =
vec![CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); 10];
let dummy_vec_size = serialized_size(&dummy_vec).unwrap();
let mut max_protocol_size;
max_protocol_size =
serialized_size(&Protocol::PullRequest(CrdsFilter::default(), contact_info)).unwrap()
- serialized_size(&CrdsFilter::default()).unwrap();
max_protocol_size = max_protocol_size.max(
serialized_size(&Protocol::PullResponse(
Pubkey::default(),
dummy_vec.clone(),
))
.unwrap()
- dummy_vec_size,
);
max_protocol_size = max_protocol_size.max(
serialized_size(&Protocol::PushMessage(Pubkey::default(), dummy_vec)).unwrap()
- dummy_vec_size,
);
max_protocol_size = max_protocol_size.max(
serialized_size(&Protocol::PruneMessage(
Pubkey::default(),
PruneData::default(),
))
.unwrap()
- serialized_size(&PruneData::default()).unwrap(),
);
// finally assert the header size estimation is correct
assert_eq!(MAX_PROTOCOL_HEADER_SIZE, max_protocol_size);
} | rust_cleaned_test_functions.jsonl/12827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 695
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34880,
2368,
368,
341,
286,
1077,
3645,
3109,
284,
4553,
5356,
1130,
486,
931,
67830,
3025,
81,
5356,
1043,
486,
8732,
1731,
99102,
1731,
486,
2258,
7392,
286,
1077,
17292,
13251,
4035,
310,
7486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_ldr() {
match decode_16(0x4907) {
Instruction::LDR_lit { params, thumb32 } => {
assert!(params.rt == Reg::R1);
assert!(params.imm32 == (7 << 2));
assert!(thumb32 == false);
assert!(params.add);
}
_ => {
assert!(false);
}
}
match decode_16(0x680a) {
Instruction::LDR_imm { params, thumb32 } => {
assert!(params.rn == Reg::R1);
assert!(params.rt == Reg::R2);
assert!(params.imm32 == 0);
assert!(params.index == true);
assert!(params.add == true);
assert!(params.wback == false);
assert!(thumb32 == false);
}
_ => {
assert!(false);
}
}
} | rust_cleaned_test_functions.jsonl/64745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
50573,
81,
368,
341,
1066,
262,
2432,
16895,
62,
16,
21,
7,
15,
87,
19,
24,
15,
22,
8,
341,
286,
29051,
486,
43,
7687,
98399,
314,
3628,
11,
24050,
18,
17,
335,
589,
341,
310,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_usepackage() {
let source1 = "import kotex";
let source2 = "import tcolorbox (many)";
let source3 = "import tcolorbox ( many )";
let source4 = "import foo (bar1, bar2)";
let source5 = "import geometry (a4paper, margin = 0.4in)";
let source6 = r#"import {
kotex
tcolorbox (many)
foo (bar1, bar2, bar3)
geometry (a4paper, margin = 0.4in)
}"#;
let source7 = r#"import {
kotex
tcolorbox (many)
foo (bar1, bar2, bar3)
geometry (a4paper, margin = 0.4in)
}"#;
let source8 = r#"import {
kotex
tcolorbox (many)
foo (
bar1, bar2,
bar3
)
geometry (a4paper, margin = 0.4in)
}"#;
let source9 = r#"import {
kotex
tcolorbox (many)
foo (
bar1,
bar2,
bar3,
)
geometry (a4paper, margin = 0.4in)
}"#;
let expected1 = "\\usepackage{kotex}\n";
let expected2 = "\\usepackage[many]{tcolorbox}\n";
let expected3 = "\\usepackage[bar1,bar2]{foo}\n";
let expected4 = "\\usepackage[a4paper,margin=0.4in]{geometry}\n";
let expected5 = r#"\usepackage{kotex}
\usepackage[many]{tcolorbox}
\usepackage[bar1,bar2,bar3]{foo}
\usepackage[a4paper,margin=0.4in]{geometry}
"#;
let mut parser1 = Parser::new(Lexer::new(source1));
let mut parser2 = Parser::new(Lexer::new(source2));
let mut parser3 = Parser::new(Lexer::new(source3));
let mut parser4 = Parser::new(Lexer::new(source4));
let mut parser5 = Parser::new(Lexer::new(source5));
let mut parser6 = Parser::new(Lexer::new(source6));
let mut parser7 = Parser::new(Lexer::new(source7));
let mut parser8 = Parser::new(Lexer::new(source8));
let mut parser9 = Parser::new(Lexer::new(source9));
assert_eq!(expected1, parser1.make_latex_format().unwrap());
assert_eq!(expected2, parser2.make_latex_format().unwrap());
assert_eq!(expected2, parser3.make_latex_format().unwrap());
assert_eq!(expected3, parser4.make_latex_format().unwrap());
assert_eq!(expected4, parser5.make_latex_format().unwrap());
assert_eq!(expected5, parser6.make_latex_format().unwrap());
assert_eq!(expected5, parser7.make_latex_format().unwrap());
assert_eq!(expected5, parser8.make_latex_format().unwrap());
assert_eq!(expected5, parser9.make_latex_format().unwrap());
} | rust_cleaned_test_functions.jsonl/131292 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15951,
1722,
368,
341,
262,
1077,
2530,
16,
284,
330,
474,
74925,
327,
876,
262,
1077,
2530,
17,
284,
330,
474,
259,
3423,
2011,
320,
34576,
24023,
262,
1077,
2530,
18,
284,
330,
474,
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_pos_string() {
assert_eq!(
Pos::make_none().string().to_string(),
r#"File "", line 0, characters 0-0:"#
);
let path = RcOc::new(RelativePath::make(Prefix::Dummy, PathBuf::from("a.php")));
assert_eq!(
Pos::from_lnum_bol_offset(path, (5, 100, 117), (5, 100, 142))
.string()
.to_string(),
r#"File "a.php", line 5, characters 18-42:"#
);
} | rust_cleaned_test_functions.jsonl/1047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6479,
3904,
368,
341,
286,
2060,
10714,
33673,
310,
18876,
486,
6927,
31488,
1005,
917,
1005,
983,
3904,
3148,
310,
435,
55543,
1703,
7342,
1555,
220,
15,
11,
5766,
220,
15,
12,
15,
2974,
4956,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_patterns_simple() {
assert!(super::match_simple("https://www.example.com", "*"));
assert!(super::match_simple(
"https://www.example.com",
"*.example.com"
));
assert!(super::match_simple(
"http://www.example.com",
"*.example.com"
));
assert!(!super::match_simple(
"http://www.example.com",
"example.com"
));
assert!(super::match_simple("http://example.com", "example.com"));
} | rust_cleaned_test_functions.jsonl/99429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64923,
30015,
368,
341,
286,
2060,
10297,
9522,
486,
6347,
30015,
445,
2428,
1110,
2136,
7724,
905,
497,
15630,
14929,
286,
2060,
10297,
9522,
486,
6347,
30015,
1006,
310,
330,
2428,
1110,
2136,
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_writer_set_threads() {
let path = &"test/test.bcf";
let tmp = tempfile::Builder::new()
.prefix("rust-htslib")
.tempdir()
.expect("Cannot create temp dir");
let bcfpath = tmp.path().join("test.bcf");
let bcf = Reader::from_path(path).expect("Error opening file.");
let header = Header::from_template_subset(&bcf.header, &[b"NA12878.subsample-0.25-0"])
.expect("Error subsetting samples.");
let mut writer =
Writer::from_path(&bcfpath, &header, false, Format::BCF).expect("Error opening file.");
writer.set_threads(2).unwrap();
} | rust_cleaned_test_functions.jsonl/8761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28908,
2602,
29725,
368,
341,
286,
1077,
1815,
284,
609,
1,
1944,
12697,
948,
9792,
876,
286,
1077,
4174,
284,
54819,
486,
3297,
486,
931,
741,
310,
659,
11849,
445,
35788,
12,
426,
82,
2740,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_guild_sticker() {
let route = Route::CreateGuildSticker { guild_id: GUILD_ID };
assert_eq!(
route.to_string(),
format!("guilds/{guild_id}/stickers", guild_id = GUILD_ID)
);
} | rust_cleaned_test_functions.jsonl/119858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
1889,
1498,
1261,
5215,
368,
341,
286,
1077,
6021,
284,
9572,
486,
4021,
72574,
623,
5215,
314,
26411,
842,
25,
479,
18023,
3450,
2605,
286,
2060,
10714,
33673,
310,
6021,
2389,
3904,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_image() {
// Read the PNG file from disk
let png_file = include_bytes!("../../test_assets/rust-logo.png");
let image_data =
image::load_from_memory_with_format(png_file, image::ImageFormat::Png).unwrap();
use image::ColorType;
let channel_count = match &image_data.color() {
ColorType::L8 => 1,
ColorType::La8 => 2,
ColorType::Rgb8 => 3,
ColorType::Rgba8 => 4,
ColorType::L16 => 1,
ColorType::La16 => 2,
ColorType::Rgb16 => 3,
ColorType::Rgba16 => 4,
ColorType::Bgr8 => 3,
ColorType::Bgra8 => 4,
_ => unimplemented!(),
};
let mut compressor_params = CompressorParams::new();
compressor_params.set_generate_mipmaps(true);
// Set up the source image in the params
let mut compressor_image = compressor_params.source_image_mut(0);
compressor_image.init(
image_data.as_bytes(),
image_data.width(),
image_data.height(),
channel_count,
);
// Create the compressor
let mut compressor = Compressor::default();
unsafe {
compressor.init(&compressor_params);
}
// Drop explicitly here to verify that borrowing rules allow this and that this doesn't cause a crash
std::mem::drop(compressor_params);
// Do the compression
unsafe {
compressor.process().unwrap();
}
// check that it works with basisu
let _basis_file = compressor.basis_file();
std::mem::drop(compressor);
} | rust_cleaned_test_functions.jsonl/63446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 677
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
4954,
368,
341,
1066,
262,
442,
4457,
279,
41639,
1034,
504,
13364,
7213,
262,
1077,
36151,
2458,
284,
2924,
12524,
17223,
2748,
1944,
53299,
7382,
590,
33797,
3508,
797,
262,
1077,
2168,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mq_getattr() {
use nix::mqueue::mq_getattr;
const MSG_SIZE: mq_attr_member_t = 32;
let initial_attr = MqAttr::new(0, 10, MSG_SIZE, 0);
let mq_name = &CString::new(b"/attr_test_get_attr".as_ref()).unwrap();
let oflag = MQ_OFlag::O_CREAT | MQ_OFlag::O_WRONLY;
let mode = Mode::S_IWUSR | Mode::S_IRUSR | Mode::S_IRGRP | Mode::S_IROTH;
let r = mq_open(mq_name, oflag, mode, Some(&initial_attr));
if let Err(Errno::ENOSYS) = r {
println!("message queues not supported or module not loaded?");
return;
};
let mqd = r.unwrap();
let read_attr = mq_getattr(mqd).unwrap();
assert_attr_eq!(read_attr, initial_attr);
mq_close(mqd).unwrap();
} | rust_cleaned_test_functions.jsonl/28037 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
80,
3062,
2991,
368,
341,
262,
990,
308,
941,
486,
76,
4584,
486,
27674,
3062,
2991,
280,
262,
733,
23317,
4098,
25,
72298,
10422,
19388,
528,
284,
220,
18,
17,
280,
262,
1077,
2856,
1042... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bit_set_difference() {
let mut a = BitSet::new();
let mut b = BitSet::new();
assert!(a.insert(1));
assert!(a.insert(3));
assert!(a.insert(5));
assert!(a.insert(200));
assert!(a.insert(500));
assert!(b.insert(3));
assert!(b.insert(200));
let expected = [1, 5, 500];
let actual: Vec<_> = a.difference(&b).collect();
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/76227 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
2602,
47525,
368,
341,
286,
1077,
5206,
264,
284,
57227,
486,
931,
543,
286,
1077,
5206,
293,
284,
57227,
486,
931,
1428,
286,
2060,
10297,
64,
7030,
7,
16,
1106,
286,
2060,
10297,
64,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_channels_with_lower_inbound_capacity_than_invoice_amt_hints_filtering() {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let chan_1_0 = create_unannounced_chan_between_nodes_with_value(&nodes, 1, 0, 100_000, 0, InitFeatures::known(), InitFeatures::known());
let chan_2_0 = create_unannounced_chan_between_nodes_with_value(&nodes, 2, 0, 1_000_000, 0, InitFeatures::known(), InitFeatures::known());
let mut scid_aliases_99_000_001_msat = HashSet::new();
scid_aliases_99_000_001_msat.insert(chan_2_0.0.short_channel_id_alias.unwrap());
match_invoice_routes(Some(99_000_001), &nodes[0], scid_aliases_99_000_001_msat);
let mut scid_aliases_99_000_000_msat = HashSet::new();
scid_aliases_99_000_000_msat.insert(chan_1_0.0.short_channel_id_alias.unwrap());
scid_aliases_99_000_000_msat.insert(chan_2_0.0.short_channel_id_alias.unwrap());
match_invoice_routes(Some(99_000_000), &nodes[0], scid_aliases_99_000_000_msat);
let mut scid_aliases_2_000_000_000_msat = HashSet::new();
scid_aliases_2_000_000_000_msat.insert(chan_1_0.0.short_channel_id_alias.unwrap());
scid_aliases_2_000_000_000_msat.insert(chan_2_0.0.short_channel_id_alias.unwrap());
match_invoice_routes(Some(2_000_000_000), &nodes[0], scid_aliases_2_000_000_000_msat);
// An invoice with no specified amount should include all channels in the route hints.
let mut scid_aliases_no_specified_amount = HashSet::new();
scid_aliases_no_specified_amount.insert(chan_1_0.0.short_channel_id_alias.unwrap());
scid_aliases_no_specified_amount.insert(chan_2_0.0.short_channel_id_alias.unwrap());
match_invoice_routes(None, &nodes[0], scid_aliases_no_specified_amount);
} | rust_cleaned_test_functions.jsonl/65876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 811
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19291,
6615,
30425,
1243,
10891,
35603,
51613,
39225,
54605,
1523,
21042,
8727,
287,
368,
341,
197,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
18,
317,
197,
10217,
2436,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_subspace() {
let query = SubspacesQuery::Subspace {
subspace_id: Uint64::new(1),
};
let response = mock_subspaces_query_response(&query);
let expected = to_binary(&QuerySubspaceResponse {
subspace: MockSubspacesQueries::get_mock_subspace(),
});
assert_eq!(response.into_result().ok(), expected.ok());
} | rust_cleaned_test_functions.jsonl/109484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
5228,
8746,
368,
341,
286,
1077,
3239,
284,
3719,
44285,
2859,
486,
3136,
8746,
341,
310,
5147,
1306,
842,
25,
27883,
21,
19,
486,
931,
7,
16,
1326,
286,
2605,
286,
1077,
2033,
284,
7860... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_name() {
let uut: Map = r"..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#
"
.parse()
.unwrap();
assert_eq!(uut.check_slope(1, 1), 2);
assert_eq!(uut.check_slope(3, 1), 7);
assert_eq!(uut.check_slope(5, 1), 3);
assert_eq!(uut.check_slope(7, 1), 4);
assert_eq!(uut.check_slope(1, 2), 2);
} | rust_cleaned_test_functions.jsonl/74233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1269,
368,
341,
286,
1077,
575,
332,
25,
5027,
284,
435,
62923,
565,
1934,
9338,
2,
1112,
2,
1112,
2,
33947,
43326,
1934,
2,
496,
2,
624,
496,
2,
43326,
1112,
87846,
4956,
43326,
1112,
565,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_variable_holder() {
const FORMAT_STR: &str = "($a [($b) $c](none $s)) $d [t]($t)";
let expected_variables = vec!["a", "b", "c", "d"]
.into_iter()
.map(String::from)
.collect();
let formatter = StringFormatter::new(FORMAT_STR).unwrap().map(empty_mapper);
let variables = formatter.get_variables();
assert_eq!(variables, expected_variables);
} | rust_cleaned_test_functions.jsonl/71892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14635,
50788,
368,
341,
286,
733,
52225,
7159,
25,
609,
495,
284,
330,
699,
64,
508,
699,
65,
8,
400,
66,
9533,
6697,
400,
82,
593,
400,
67,
508,
83,
60,
699,
83,
24023,
286,
1077,
3601,
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_etag_parse_failures() {
// Expected failures
assert!("no-dquotes".parse::<EntityTag>().is_err());
assert!("w/\"the-first-w-is-case-sensitive\""
.parse::<EntityTag>()
.is_err());
assert!("".parse::<EntityTag>().is_err());
assert!("\"unmatched-dquotes1".parse::<EntityTag>().is_err());
assert!("unmatched-dquotes2\"".parse::<EntityTag>().is_err());
assert!("matched-\"dquotes\"".parse::<EntityTag>().is_err());
} | rust_cleaned_test_functions.jsonl/21996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45668,
351,
21039,
22121,
1413,
368,
341,
286,
442,
31021,
27850,
198,
286,
2060,
17223,
2152,
1737,
53282,
3263,
6400,
27638,
3030,
5668,
10483,
285,
9266,
1423,
286,
2060,
17223,
86,
14,
2105,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_payload_size_validation() {
const MAX_SIZE: u64 = 2 * 1024 * 1024;
// little bit smaller than the overall size
const ONE_QUARTER: usize = 512 * 1024 - 1000;
const THREE_QUARTER: usize = 3 * 512 * 1024 - 1000;
ic_test_utilities::artifact_pool_config::with_test_pool_config(|pool_config| {
let mut subnet_record = SubnetRecordBuilder::from(&[node_test_id(0)]).build();
// NOTE: We can't set smaller values
subnet_record.max_block_payload_size = MAX_SIZE;
subnet_record.max_ingress_bytes_per_message = MAX_SIZE;
let subnet_records = SubnetRecords {
latest: subnet_record.clone(),
stable: subnet_record.clone(),
};
let Dependencies { registry, .. } = dependencies_with_subnet_params(
pool_config.clone(),
subnet_test_id(0),
vec![(1, subnet_record)],
);
let ingress_pool = TestIngressPool::new(pool_config);
let context = ValidationContext {
certified_height: Height::from(0),
registry_version: RegistryVersion::from(1),
time: mock_time(),
};
// Prepare the messages in the mock
let make_ingress = |nonce, size| {
vec![SignedIngressBuilder::new()
.method_payload(vec![0; size])
.nonce(nonce)
.build()]
};
let make_slice = |height, size| {
let mut map = BTreeMap::new();
map.insert(
subnet_test_id(1),
make_certified_stream_slice(height, vec![0; size], vec![]),
);
map
};
let certified_streams: Vec<BTreeMap<SubnetId, CertifiedStreamSlice>> = vec![
make_slice(0, THREE_QUARTER),
make_slice(1, ONE_QUARTER),
make_slice(2, THREE_QUARTER),
];
let ingress = vec![
make_ingress(0, ONE_QUARTER),
make_ingress(1, THREE_QUARTER),
make_ingress(2, THREE_QUARTER),
];
let payload_builder = make_test_payload_impl(registry, ingress, certified_streams);
// Build first payload and then validate it
let payload0 = payload_builder.get_payload(
Height::from(0),
&ingress_pool,
&[],
&context,
&subnet_records,
);
let wrapped_payload0 = batch_payload_to_payload(0, payload0);
payload_builder
.validate_payload(&wrapped_payload0, &[], &context)
.unwrap();
// Build second payload and validate it
let past_payload0 = [(Height::from(0), mock_time(), wrapped_payload0)];
let payload1 = payload_builder.get_payload(
Height::from(1),
&ingress_pool,
&past_payload0,
&context,
&subnet_records,
);
let wrapped_payload1 = batch_payload_to_payload(0, payload1);
payload_builder
.validate_payload(&wrapped_payload1, &past_payload0, &context)
.unwrap();
// Build third payload and validate it
let past_payload1 = [(Height::from(1), mock_time(), wrapped_payload1)];
let payload2 = payload_builder.get_payload(
Height::from(2),
&ingress_pool,
&past_payload1,
&context,
&subnet_records,
);
let pb_result = payload_builder.validate_payload(
&batch_payload_to_payload(1, payload2),
&past_payload1,
&context,
);
match pb_result {
Err(
ValidationError::<PayloadPermanentError, PayloadTransientError>::Permanent(
PayloadPermanentError::PayloadTooBig { .. },
),
) => (),
_ => panic!("Expected PayloadTooBig error"),
}
});
} | rust_cleaned_test_functions.jsonl/30515 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32813,
2368,
19416,
368,
341,
286,
733,
8334,
4098,
25,
575,
21,
19,
284,
220,
17,
353,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
280,
1789,
286,
442,
2632,
2699,
9155,
1091,
279,
808... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arm64_op_type() {
use super::arm64_op_type::*;
use super::Arm64OperandType::*;
use super::Arm64Sysreg::*;
use capstone_sys::arm64_pstate::*;
fn t(
op_type_value: (arm64_op_type, cs_arm64_op__bindgen_ty_2),
expected_op_type: Arm64OperandType,
) {
let (op_type, op_value) = op_type_value;
let op_type = Arm64OperandType::new(op_type, op_value);
assert_eq!(expected_op_type, op_type);
}
t(
(ARM64_OP_INVALID, cs_arm64_op__bindgen_ty_2 { reg: 0 }),
Invalid,
);
t(
(ARM64_OP_REG, cs_arm64_op__bindgen_ty_2 { reg: 0 }),
Reg(RegId(0)),
);
t(
(ARM64_OP_IMM, cs_arm64_op__bindgen_ty_2 { imm: 42 }),
Imm(42),
);
t(
(ARM64_OP_REG_MRS, cs_arm64_op__bindgen_ty_2 { reg: ARM64_SYSREG_MDRAR_EL1 as u32 }),
RegMrs(ARM64_SYSREG_MDRAR_EL1),
);
t(
(ARM64_OP_PSTATE, cs_arm64_op__bindgen_ty_2 { pstate: ARM64_PSTATE_SPSEL }),
Pstate(Arm64Pstate::ARM64_PSTATE_SPSEL),
);
} | rust_cleaned_test_functions.jsonl/8316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34680,
21,
19,
10287,
1819,
368,
341,
286,
990,
2256,
486,
2178,
21,
19,
10287,
1819,
56162,
286,
990,
2256,
486,
32913,
21,
19,
29940,
929,
56162,
286,
990,
2256,
486,
32913,
21,
19,
32792,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_max_snapshot_hashes_with_pull_responses() {
let mut rng = rand::thread_rng();
for _ in 0..256 {
let snapshot_hash = SnapshotHash::new_rand(&mut rng, None);
let crds_value =
CrdsValue::new_signed(CrdsData::AccountsHashes(snapshot_hash), &Keypair::new());
let response = Protocol::PullResponse(Pubkey::new_unique(), vec![crds_value]);
let socket = new_rand_socket_addr(&mut rng);
assert!(Packet::from_data(Some(&socket), response).is_ok());
}
} | rust_cleaned_test_functions.jsonl/11651 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
53265,
91616,
6615,
65693,
81292,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
369,
716,
304,
220,
15,
496,
17,
20,
21,
341,
310,
1077,
16295,
8950,
284,
68697... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_diagnostics_lib() {
let (mut runtime, state_snapshot, _) = setup(
false,
json!({
"target": "esnext",
"module": "esnext",
"jsx": "react",
"lib": ["esnext", "dom", "deno.ns"],
"noEmit": true,
}),
&[(
"file:///a.ts",
r#"console.log(document.location);"#,
1,
LanguageId::TypeScript,
)],
);
let specifier = resolve_url("file:///a.ts").expect("could not resolve url");
let result = request(
&mut runtime,
state_snapshot,
RequestMethod::GetDiagnostics(vec![specifier]),
);
assert!(result.is_ok());
let response = result.unwrap();
assert_eq!(response, json!({ "file:///a.ts": [] }));
} | rust_cleaned_test_functions.jsonl/23621 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
814,
18938,
16142,
368,
341,
262,
1077,
320,
6984,
15592,
11,
1584,
53265,
11,
27439,
284,
6505,
1006,
414,
895,
345,
414,
2951,
0,
2262,
286,
330,
5657,
788,
330,
288,
3600,
756,
286,
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_ranks() {
let sorted_distinct = [1.0, 2.0, 4.0, 7.0, 8.0, 9.0, 10.0, 12.0];
let mut sorted_distinct = Data::new(sorted_distinct);
let sorted_ties = [1.0, 2.0, 2.0, 7.0, 9.0, 9.0, 10.0, 12.0];
let mut sorted_ties = Data::new(sorted_ties);
assert_eq!(
sorted_distinct.ranks(RankTieBreaker::Average),
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
);
assert_eq!(
sorted_ties.ranks(RankTieBreaker::Average),
[1.0, 2.5, 2.5, 4.0, 5.5, 5.5, 7.0, 8.0]
);
assert_eq!(
sorted_distinct.ranks(RankTieBreaker::Min),
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
);
assert_eq!(
sorted_ties.ranks(RankTieBreaker::Min),
[1.0, 2.0, 2.0, 4.0, 5.0, 5.0, 7.0, 8.0]
);
assert_eq!(
sorted_distinct.ranks(RankTieBreaker::Max),
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
);
assert_eq!(
sorted_ties.ranks(RankTieBreaker::Max),
[1.0, 3.0, 3.0, 4.0, 6.0, 6.0, 7.0, 8.0]
);
assert_eq!(
sorted_distinct.ranks(RankTieBreaker::First),
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
);
assert_eq!(
sorted_ties.ranks(RankTieBreaker::First),
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
);
let distinct = [1.0, 8.0, 12.0, 7.0, 2.0, 9.0, 10.0, 4.0];
let distinct = Data::new(distinct);
let ties = [1.0, 9.0, 12.0, 7.0, 2.0, 9.0, 10.0, 2.0];
let ties = Data::new(ties);
assert_eq!(
distinct.clone().ranks(RankTieBreaker::Average),
[1.0, 5.0, 8.0, 4.0, 2.0, 6.0, 7.0, 3.0]
);
assert_eq!(
ties.clone().ranks(RankTieBreaker::Average),
[1.0, 5.5, 8.0, 4.0, 2.5, 5.5, 7.0, 2.5]
);
assert_eq!(
distinct.clone().ranks(RankTieBreaker::Min),
[1.0, 5.0, 8.0, 4.0, 2.0, 6.0, 7.0, 3.0]
);
assert_eq!(
ties.clone().ranks(RankTieBreaker::Min),
[1.0, 5.0, 8.0, 4.0, 2.0, 5.0, 7.0, 2.0]
);
assert_eq!(
distinct.clone().ranks(RankTieBreaker::Max),
[1.0, 5.0, 8.0, 4.0, 2.0, 6.0, 7.0, 3.0]
);
assert_eq!(
ties.clone().ranks(RankTieBreaker::Max),
[1.0, 6.0, 8.0, 4.0, 3.0, 6.0, 7.0, 3.0]
);
assert_eq!(
distinct.clone().ranks(RankTieBreaker::First),
[1.0, 5.0, 8.0, 4.0, 2.0, 6.0, 7.0, 3.0]
);
assert_eq!(
ties.clone().ranks(RankTieBreaker::First),
[1.0, 5.0, 8.0, 4.0, 2.0, 6.0, 7.0, 3.0]
);
} | rust_cleaned_test_functions.jsonl/81931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1795
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
4039,
368,
341,
286,
1077,
10615,
16031,
7800,
284,
508,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
19,
13,
15,
11,
220,
22,
13,
15,
11,
220,
23,
13,
15,
11,
220,
24,
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_sparse_merge_sparse() {
let builder = PassThroughHasherBuilder {};
let mut hll: HyperLogLogPlus<u64, PassThroughHasherBuilder> =
HyperLogLogPlus::new(16, builder).unwrap();
let hashes: [u64; 3] =
[0xf000017000000000, 0x000fff8f00000000, 0x0f00017000000000];
let hash_codes: [u32; 3] = [
hll.encode_hash(hashes[0]),
hll.encode_hash(hashes[1]),
hll.encode_hash(hashes[2]),
];
// Insert a couple of hashes.
hll.add(&hashes[0]);
assert!(hll.tmpset.contains(&hash_codes[0]));
hll.add(&hashes[1]);
assert!(hll.tmpset.contains(&hash_codes[1]));
assert_eq!(hll.tmpset.len(), 2);
assert_eq!(hll.sparse.len(), 0);
// Merge and check hashes.
hll.merge_sparse();
assert_eq!(hll.sparse.count(), 2);
assert_eq!(hll.tmpset.len(), 0);
let hll_hash_codes: Vec<u32> = hll.sparse.into_iter().collect();
assert_eq!(hll_hash_codes, vec![hash_codes[1], hash_codes[0]]);
// Insert another hash.
hll.add(&hashes[2]);
assert!(hll.tmpset.contains(&hash_codes[2]));
// Merge and check hashes again.
hll.merge_sparse();
assert_eq!(hll.sparse.count(), 3);
assert_eq!(hll.tmpset.len(), 0);
let hll_hash_codes: Vec<u32> = hll.sparse.into_iter().collect();
assert_eq!(
hll_hash_codes,
vec![hash_codes[1], hash_codes[2], hash_codes[0]]
);
} | rust_cleaned_test_functions.jsonl/8344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 809
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71123,
20888,
71123,
368,
341,
286,
1077,
7363,
284,
9970,
23857,
6370,
261,
3297,
20375,
286,
1077,
5206,
305,
654,
25,
32732,
2201,
2201,
21807,
34837,
21,
19,
11,
9970,
23857,
6370,
261,
3297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_polygon_element() {
use crate::prelude::*;
let points = vec![(100, 100), (50, 500), (300, 400), (200, 300), (550, 200)];
let expected_points = points.clone();
let da = crate::create_mocked_drawing_area(800, 800, |m| {
m.check_fill_polygon(move |c, p| {
assert_eq!(c, BLUE.to_rgba());
assert_eq!(expected_points.len(), p.len());
assert_eq!(expected_points, p);
});
m.drop_check(|b| {
assert_eq!(b.num_fill_polygon_call, 1);
assert_eq!(b.draw_count, 1);
});
});
da.draw(&Polygon::new(points.clone(), &BLUE))
.expect("Drawing Failure");
} | rust_cleaned_test_functions.jsonl/76170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73542,
7894,
368,
341,
262,
990,
17717,
486,
1726,
52538,
56162,
262,
1077,
3501,
284,
7486,
0,
9697,
16,
15,
15,
11,
220,
16,
15,
15,
701,
320,
20,
15,
11,
220,
20,
15,
15,
701,
320,
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_resolve_addr() {
use std::str::FromStr;
assert_eq!(
resolve_addr(NameOrAddress::Name("dai".to_string()), Chain::Mainnet).ok(),
Some(NameOrAddress::Address(
Address::from_str("0x6b175474e89094c44da98b954eedeac495271d0f").unwrap()
))
);
assert_eq!(
resolve_addr(NameOrAddress::Name("dai".to_string()), Chain::Goerli).ok(),
Some(NameOrAddress::Address(
Address::from_str("0x11fE4B6AE13d2a6055C8D9cF65c55bac32B5d844").unwrap()
))
);
// DAI:moonbean does not exist in addressbook
assert!(resolve_addr(NameOrAddress::Name("dai".to_string()), Chain::MoonbeamDev).is_err());
assert_eq!(
resolve_addr(NameOrAddress::Name("contractnotpresent".to_string()), Chain::Mainnet)
.ok(),
Some(NameOrAddress::Name("contractnotpresent".to_string())),
);
// Nothing to resolve for an address.
assert_eq!(
resolve_addr(NameOrAddress::Address(Address::zero()), Chain::Mainnet).ok(),
Some(NameOrAddress::Address(Address::zero())),
);
} | rust_cleaned_test_functions.jsonl/61766 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 624
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
7387,
368,
341,
286,
990,
1460,
486,
495,
486,
3830,
2580,
401,
1789,
286,
2060,
10714,
33673,
310,
8830,
7387,
21182,
2195,
4286,
486,
675,
445,
67,
2143,
3263,
983,
3904,
11858,
28525,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iter() {
let xs = vec![(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)];
let map: TrieMap<i32> = xs.iter().map(|&x| x).collect();
for &(k, v) in xs.iter() {
assert_eq!(map.get(&k), Some(&v));
}
} | rust_cleaned_test_functions.jsonl/88422 | {
"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,
5673,
11723,
368,
341,
286,
1077,
11943,
284,
7486,
0,
9697,
16,
11,
220,
16,
701,
320,
17,
11,
220,
17,
701,
320,
18,
11,
220,
18,
701,
320,
19,
11,
220,
19,
701,
320,
20,
11,
220,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_request_next_title() -> Result<(), Error> {
let url = "https://minecraft.gamepedia.com/api.php";
assert_eq!(
request_next_title("'Tis but a scratch", url)?,
Some("...has_become_the_master".to_string())
);
// last element
assert_eq!(request_next_title("Žodynas/lt", url)?, None);
Ok(())
} | rust_cleaned_test_functions.jsonl/43822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
11257,
6112,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
2515,
284,
330,
2428,
1110,
72538,
9105,
82050,
905,
10508,
2296,
876,
286,
2060,
10714,
33673,
310,
1681,
11257,
6112,
45456,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inline_fragments() {
assert!(are_selections_equal(
r#"
fragment Left on Actor {
... on User {
name
}
}
fragment Right on User {
... on User {
name
}
}
"#
));
assert!(!are_selections_equal(
r#"
fragment Left on Actor {
... on Actor {
name
}
}
fragment Right on Actor {
... on User {
name
}
}
"#
));
assert!(!are_selections_equal(
// We compare directives for inline fragments in Rust
r#"
fragment Left on Actor {
... on User @defer(label: "Zuck") {
name
}
}
fragment Right on User {
... on User @defer(label: "Mark") {
name
}
}
"#
));
} | rust_cleaned_test_functions.jsonl/6185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 838
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41871,
761,
41956,
368,
341,
262,
2060,
10297,
546,
23672,
82,
11478,
1006,
286,
435,
2,
698,
394,
12289,
13727,
389,
24718,
341,
503,
2503,
389,
2657,
341,
664,
829,
198,
503,
456,
394,
456,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove() -> anyhow::Result<()> {
let rt = tokio::runtime::Runtime::new()?;
rt.block_on(async {
let pool: Pool<FakeTag> = Pool::new();
let res = pool.entry("one_tag").await;
assert!(res.is_ok());
assert_eq!(pool.len(), 1);
pool.remove("one_tag");
assert_eq!(pool.len(), 0);
});
Ok(())
} | rust_cleaned_test_functions.jsonl/75281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
368,
1464,
88964,
486,
2077,
71698,
972,
286,
1077,
16677,
284,
9628,
815,
486,
22255,
486,
15123,
486,
931,
93333,
463,
286,
16677,
15697,
4470,
18285,
972,
310,
1077,
7314,
25,
22728,
304... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_relu_derivative() {
fn f(x: f32, alpha: Option<f32>, max_value: Option<f32>, threshold: Option<f32>) -> f32 {
let t = match threshold {
None => 0.0,
Some(v) => v,
};
let a = match alpha {
None => 0.0,
Some(v) => v,
};
let result = if x > t {
1.0
} else if x == t {
(1.0 + a) / 2.0
} else {
a
};
match max_value {
None => result,
Some(m) => {
if x > m {
0.0
} else if x == m {
0.5
} else {
result
}
}
}
}
let mut alpha = Some(0.0);
let mut max_value = None;
let mut threshold = Some(0.0);
let mut activation = Activation::ReLu {
alpha,
max_value,
threshold,
};
assert_eq!(
activation.calculate_derivative(&array![[0.0]]).unwrap(),
&array![[f(0.0, alpha, max_value, threshold)]]
);
assert_eq!(
activation
.calculate_derivative(&array![[0.0, 1.0]])
.unwrap(),
&array![[
f(0.0, alpha, max_value, threshold),
f(1.0, alpha, max_value, threshold)
]]
);
assert_eq!(
activation
.calculate_derivative(&array![[0.0], [1.0]])
.unwrap(),
&array![
[f(0.0, alpha, max_value, threshold)],
[f(1.0, alpha, max_value, threshold)]
]
);
assert_eq!(
activation
.calculate_derivative(&array![[0.0, 1.0], [2.0, 3.0]])
.unwrap(),
&array![
[
f(0.0, alpha, max_value, threshold),
f(1.0, alpha, max_value, threshold)
],
[
f(2.0, alpha, max_value, threshold),
f(3.0, alpha, max_value, threshold)
]
]
);
alpha = Some(0.001);
max_value = Some(1.0);
threshold = Some(0.0);
activation = Activation::ReLu {
alpha,
max_value,
threshold,
};
assert_eq!(
activation.calculate_derivative(&array![[0.0]]).unwrap(),
&array![[f(0.0, alpha, max_value, threshold)]]
);
assert_eq!(
activation
.calculate_derivative(&array![[0.0, 1.0]])
.unwrap(),
&array![[
f(0.0, alpha, max_value, threshold),
f(1.0, alpha, max_value, threshold)
]]
);
assert_eq!(
activation
.calculate_derivative(&array![[0.0], [1.0]])
.unwrap(),
&array![
[f(0.0, alpha, max_value, threshold)],
[f(1.0, alpha, max_value, threshold)]
]
);
assert_eq!(
activation
.calculate_derivative(&array![[0.0, 1.0], [2.0, 3.0]])
.unwrap(),
&array![
[
f(0.0, alpha, max_value, threshold),
f(1.0, alpha, max_value, threshold)
],
[
f(2.0, alpha, max_value, threshold),
f(3.0, alpha, max_value, threshold)
]
]
);
} | rust_cleaned_test_functions.jsonl/65374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76282,
95930,
368,
341,
286,
5168,
282,
2075,
25,
282,
18,
17,
11,
8287,
25,
6959,
63895,
18,
17,
8066,
1932,
3142,
25,
6959,
63895,
18,
17,
8066,
12171,
25,
6959,
63895,
18,
17,
9231,
1464,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_too_short_buffer_with_iso_2022_jp_roman_from_utf8() {
let mut dst = [0u8; 16];
let mut encoder = ISO_2022_JP.new_encoder();
{
let (result, _, _, _) = encoder.encode_from_utf8("\u{A5}", &mut dst[..], false);
assert_eq!(result, CoderResult::InputEmpty);
}
{
let (result, _, _, _) = encoder.encode_from_utf8("", &mut dst[..8], false);
assert_eq!(result, CoderResult::InputEmpty);
}
{
let (result, _, _, _) = encoder.encode_from_utf8("", &mut dst[..8], true);
assert_eq!(result, CoderResult::OutputFull);
}
} | rust_cleaned_test_functions.jsonl/90274 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
78,
16673,
7776,
6615,
49660,
62,
17,
15,
17,
17,
5374,
79,
62,
62014,
5673,
39453,
23,
368,
341,
286,
1077,
5206,
10648,
284,
508,
15,
84,
23,
26,
220,
16,
21,
935,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_floor() {
assert_approx_eq!(1.0f64.floor(), 1.0f64);
assert_approx_eq!(1.3f64.floor(), 1.0f64);
assert_approx_eq!(1.5f64.floor(), 1.0f64);
assert_approx_eq!(1.7f64.floor(), 1.0f64);
assert_approx_eq!(0.0f64.floor(), 0.0f64);
assert_approx_eq!((-0.0f64).floor(), -0.0f64);
assert_approx_eq!((-1.0f64).floor(), -1.0f64);
assert_approx_eq!((-1.3f64).floor(), -2.0f64);
assert_approx_eq!((-1.5f64).floor(), -2.0f64);
assert_approx_eq!((-1.7f64).floor(), -2.0f64);
} | rust_cleaned_test_functions.jsonl/7432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60044,
368,
341,
286,
2060,
90425,
10714,
10297,
16,
13,
15,
69,
21,
19,
12889,
1507,
220,
16,
13,
15,
69,
21,
19,
317,
286,
2060,
90425,
10714,
10297,
16,
13,
18,
69,
21,
19,
12889,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_tower_wrong_identity() {
let identity_keypair = Arc::new(Keypair::new());
let tower = Tower::default();
let tower_storage = FileTowerStorage::default();
assert_matches!(
tower.save(&tower_storage, &identity_keypair),
Err(TowerError::WrongTower(_))
)
} | rust_cleaned_test_functions.jsonl/120610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
528,
1202,
75198,
46244,
368,
341,
286,
1077,
9569,
3097,
12670,
284,
19689,
486,
931,
7,
6608,
1082,
1310,
486,
931,
1423,
286,
1077,
21271,
284,
21938,
486,
2258,
543,
286,
1077,
21271,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_request_instruction() {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config_with_leader(
1_000_000_000_000_000,
&Pubkey::new_unique(),
bootstrap_validator_stake_lamports(),
);
let mut bank = Bank::new_for_tests(&genesis_config);
fn mock_ix_processor(
_first_instruction_account: usize,
_data: &[u8],
invoke_context: &mut dyn InvokeContext,
) -> std::result::Result<(), InstructionError> {
let compute_budget = invoke_context.get_compute_budget();
assert_eq!(
*compute_budget,
ComputeBudget {
max_units: 1,
heap_size: Some(48 * 1024),
..ComputeBudget::default()
}
);
Ok(())
}
let program_id = solana_sdk::pubkey::new_rand();
bank.add_builtin("mock_program", &program_id, mock_ix_processor);
let message = Message::new(
&[
ComputeBudgetInstruction::request_units(1),
ComputeBudgetInstruction::request_heap_frame(48 * 1024),
Instruction::new_with_bincode(program_id, &0, vec![]),
],
Some(&mint_keypair.pubkey()),
);
let tx = Transaction::new(&[&mint_keypair], message, bank.last_blockhash());
bank.process_transaction(&tx).unwrap();
} | rust_cleaned_test_functions.jsonl/68733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 836
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
7893,
54923,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
284,
1855,
1632... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_number_neighbor() {
assert_eq!(vec![221, 223, 212, 232, 122, 322], number_neighbor(222));
} | rust_cleaned_test_functions.jsonl/13478 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 62
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5500,
71888,
368,
341,
286,
2060,
10714,
10297,
4083,
20703,
17,
17,
16,
11,
220,
17,
17,
18,
11,
220,
17,
16,
17,
11,
220,
17,
18,
17,
11,
220,
16,
17,
17,
11,
220,
18,
17,
17,
1125,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_split_rent_exemptness() {
let rent = Rent::default();
let source_rent_exempt_reserve = rent.minimum_balance(StakeState::size_of() + 100);
let split_rent_exempt_reserve = rent.minimum_balance(StakeState::size_of());
let minimum_delegation = crate::get_minimum_delegation(&FeatureSet::all_enabled());
let stake_lamports = source_rent_exempt_reserve + minimum_delegation;
let stake_address = solana_sdk::pubkey::new_rand();
let meta = Meta {
authorized: Authorized::auto(&stake_address),
rent_exempt_reserve: source_rent_exempt_reserve,
..Meta::default()
};
let split_to_address = solana_sdk::pubkey::new_rand();
let instruction_accounts = vec![
AccountMeta {
pubkey: stake_address,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: split_to_address,
is_signer: false,
is_writable: false,
},
];
for state in &[
StakeState::Initialized(meta),
just_stake(meta, stake_lamports - source_rent_exempt_reserve),
] {
// Test that splitting to a larger account fails
let stake_account = AccountSharedData::new_data_with_space(
stake_lamports,
&state,
StakeState::size_of(),
&id(),
)
.unwrap();
let split_to_account = AccountSharedData::new_data_with_space(
0,
&StakeState::Uninitialized,
StakeState::size_of() + 10000,
&id(),
)
.unwrap();
let transaction_accounts = vec![
(stake_address, stake_account),
(split_to_address, split_to_account),
(
sysvar::rent::id(),
account::create_account_shared_data_for_test(&rent),
),
];
process_instruction(
&serialize(&StakeInstruction::Split(stake_lamports)).unwrap(),
transaction_accounts,
instruction_accounts.clone(),
Err(InstructionError::InvalidAccountData),
);
// Test that splitting from a larger account to a smaller one works.
let stake_account = AccountSharedData::new_data_with_space(
stake_lamports,
&state,
StakeState::size_of() + 100,
&id(),
)
.unwrap();
let split_to_account = AccountSharedData::new_data_with_space(
0,
&StakeState::Uninitialized,
StakeState::size_of(),
&id(),
)
.unwrap();
let transaction_accounts = vec![
(stake_address, stake_account),
(split_to_address, split_to_account),
(
sysvar::rent::id(),
account::create_account_shared_data_for_test(&rent),
),
];
let accounts = process_instruction(
&serialize(&StakeInstruction::Split(stake_lamports)).unwrap(),
transaction_accounts,
instruction_accounts.clone(),
Ok(()),
);
assert_eq!(accounts[1].lamports(), stake_lamports);
let expected_split_meta = Meta {
authorized: Authorized::auto(&stake_address),
rent_exempt_reserve: split_rent_exempt_reserve,
..Meta::default()
};
match state {
StakeState::Initialized(_) => {
assert_eq!(
Ok(StakeState::Initialized(expected_split_meta)),
accounts[1].state()
);
assert_eq!(Ok(StakeState::Uninitialized), accounts[0].state());
}
StakeState::Stake(_meta, stake) => {
// Expected stake should reflect original stake amount so that extra lamports
// from the rent_exempt_reserve inequality do not magically activate
let expected_stake = stake_lamports - source_rent_exempt_reserve;
assert_eq!(
Ok(StakeState::Stake(
expected_split_meta,
Stake {
delegation: Delegation {
stake: expected_stake,
..stake.delegation
},
..*stake
}
)),
accounts[1].state()
);
assert_eq!(
accounts[1].lamports(),
expected_stake + source_rent_exempt_reserve,
);
assert_eq!(Ok(StakeState::Uninitialized), accounts[0].state());
}
_ => unreachable!(),
}
}
} | rust_cleaned_test_functions.jsonl/31664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3027
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
83127,
95736,
2090,
368,
341,
286,
1077,
8016,
284,
29737,
486,
2258,
543,
286,
1077,
2530,
83127,
95736,
89591,
284,
8016,
57790,
29396,
7,
623,
726,
1397,
486,
2141,
3575,
368,
488,
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... | 3 |
#[test]
fn test_scaling_user_fee_by_5_percent() {
let provided_fee = BigDecimal::from_str("0.30").unwrap();
let provided_fee_scaled_by_five_percent = BigDecimal::from_str("0.315").unwrap();
let scaled_fee = scale_user_fee_up(provided_fee);
assert_eq!(provided_fee_scaled_by_five_percent, scaled_fee);
} | rust_cleaned_test_functions.jsonl/19258 | {
"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,
79216,
3317,
34305,
3710,
62,
20,
29883,
368,
341,
286,
1077,
3897,
34305,
284,
20618,
486,
1499,
2895,
445,
15,
13,
18,
15,
1827,
15454,
543,
286,
1077,
3897,
34305,
61715,
3710,
95258,
29883,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sk_encrypt_toy_param_scalar() {
let fv = FV::new(16, &Scalar::new_modulus(65537));
let sk = fv.generate_key();
let v = vec![0; fv.n];
let ct = fv.encrypt_sk(&v, &sk);
let pt_actual: Vec<u8> = fv.decrypt(&ct, &sk);
assert_eq!(v, pt_actual);
} | rust_cleaned_test_functions.jsonl/103687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33811,
66593,
528,
2253,
4090,
41652,
368,
341,
286,
1077,
61654,
284,
434,
53,
486,
931,
7,
16,
21,
11,
609,
20639,
486,
931,
7480,
19425,
7,
21,
20,
20,
18,
22,
3237,
286,
1077,
1901,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_FCMPG() {
let frame = create_frame(1.21, 1.1);
let thread = Thread::new().push_frame(frame);
let (ExecuteResult { thread, offset: _ }, _) =
FCMPG(CodeReader::new(Rc::new(vec![])), thread);
let (frame, _) = thread.pop_frame();
let (val, _) = frame.operand_stack.pop_int();
assert_eq!(val, 1);
} | rust_cleaned_test_functions.jsonl/74085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79903,
5781,
38,
368,
341,
286,
1077,
4034,
284,
1855,
8929,
7,
16,
13,
17,
16,
11,
220,
16,
13,
16,
317,
286,
1077,
4516,
284,
8752,
486,
931,
1005,
9077,
8929,
15046,
317,
286,
1077,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
test_op!(_05_05i + _05_05i, _1_1i);
test_op!(_0_1i + _1_0i, _1_1i);
test_op!(_1_0i + _neg1_1i, _0_1i);
for &c in all_consts.iter() {
test_op!(_0_0i + c, c);
test_op!(c + _0_0i, c);
}
} | rust_cleaned_test_functions.jsonl/105707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
368,
341,
310,
1273,
10287,
0,
2490,
15,
20,
62,
15,
20,
72,
488,
716,
15,
20,
62,
15,
20,
72,
11,
716,
16,
62,
16,
72,
317,
310,
1273,
10287,
0,
2490,
15,
62,
16,
72,
488,
716,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_relative_am_w_negative_number() {
let mut cpu = setup(0x90, true, 0x30, Some(0x80));
cpu.writ_byte(0x10, 0x10);
let result = relative_am(&mut cpu);
assert_eq!(result.ok(), Some(AbsoluteAddress(0x10)));
} | rust_cleaned_test_functions.jsonl/26580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29286,
22880,
1670,
53865,
5500,
368,
341,
286,
1077,
5206,
17319,
284,
6505,
7,
15,
87,
24,
15,
11,
830,
11,
220,
15,
87,
18,
15,
11,
4329,
7,
15,
87,
23,
15,
1106,
286,
17319,
78173,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_history_indexing() {
let mut h = History::new();
h.push(Buffer::from("a")).unwrap();
h.push(Buffer::from("b")).unwrap();
h.push(Buffer::from("c")).unwrap();
assert_eq!(h.len(), 3);
assert_eq!(String::from(h.buffers[0].clone()), "a".to_string());
assert_eq!(String::from(h.buffers[1].clone()), "b".to_string());
assert_eq!(String::from(h.buffers[2].clone()), "c".to_string());
} | rust_cleaned_test_functions.jsonl/29127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19802,
3560,
287,
368,
341,
262,
1077,
5206,
305,
284,
11099,
486,
931,
543,
262,
305,
2552,
55574,
486,
1499,
445,
64,
15197,
15454,
543,
262,
305,
2552,
55574,
486,
1499,
445,
65,
15197,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_capacity() {
let mut buffer = CircleBuffer::with_capacity(3);
assert_eq!(3, buffer.capacity());
buffer.push(1);
assert_eq!(3, buffer.capacity());
buffer.push(2);
assert_eq!(3, buffer.capacity());
buffer.push(3);
assert_eq!(3, buffer.capacity());
buffer.push(4);
assert_eq!(3, buffer.capacity());
buffer.push(5);
assert_eq!(3, buffer.capacity());
} | rust_cleaned_test_functions.jsonl/51000 | {
"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,
35603,
368,
341,
286,
1077,
5206,
4147,
284,
21224,
4095,
486,
4197,
35603,
7,
18,
317,
286,
2060,
10714,
10297,
18,
11,
4147,
59168,
1423,
286,
4147,
2552,
7,
16,
317,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_with_ellipsis() {
assert_eq!(format_with_ellipsis("abcde", 4), "ab… ");
assert_eq!(format_with_ellipsis("abcde", 10), "abcde ");
} | rust_cleaned_test_functions.jsonl/40538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
6615,
62,
71922,
368,
341,
286,
2060,
10714,
10297,
2243,
6615,
62,
71922,
445,
13683,
450,
497,
220,
19,
701,
330,
370,
1940,
7318,
286,
2060,
10714,
10297,
2243,
6615,
62,
71922,
445,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cases_by_author() {
// tinymt32 0x8f7011ee 0xfc78ff1f 0x3793fdff seed = 1
let mut tinymt = TinyMT32::new([0, 0, 0, 0], 0x8f7011ee, 0xfc78ff1f, 0x3793fdff);
let seed = 1;
tinymt32_init(&mut tinymt, seed);
test_generate_uint32(&mut tinymt);
// init_by_array {1}
let seed_array: [u32; 1] = [1];
tinymt32_init_by_array(&mut tinymt, &seed_array);
test_generate_float(&mut tinymt);
test_generate_float12(&mut tinymt);
test_generate_float_oc(&mut tinymt);
test_generate_float_oo(&mut tinymt);
test_generate_32double(&mut tinymt);
} | rust_cleaned_test_functions.jsonl/30195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41427,
3710,
22938,
368,
341,
220,
442,
24790,
1600,
83,
18,
17,
220,
15,
87,
23,
69,
22,
15,
16,
16,
2127,
220,
15,
40428,
22,
23,
542,
16,
69,
220,
15,
87,
18,
22,
24,
18,
6902,
542,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tail() {
let mut a = vec![11];
let b: &[i32] = &[];
assert_eq!(a.tail(), b);
a = vec![11, 12];
let b: &[i32] = &[12];
assert_eq!(a.tail(), b);
} | rust_cleaned_test_functions.jsonl/111374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35471,
368,
341,
286,
1077,
5206,
264,
284,
7486,
20703,
16,
16,
935,
286,
1077,
293,
25,
44590,
72,
18,
17,
60,
284,
609,
15078,
286,
2060,
10714,
10297,
64,
38711,
1507,
293,
317,
286,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_state_invariant()
{
test_parse("state s{ invariant {} }");
test_parse("state s{ invariant x {} }");
test_parse("state s{ invariant @(y) {} }");
test_parse("state s{ invariant {}@{-desc-} }");
test_parse("state s{ invariant x@(y){}@{-desc-} }");
test_parse("state s{ invariant { x; } }");
test_parse("state s{ invariant { x => y; } }");
test_parse("state s{ invariant { a b && c => d (e f); } }");
test_parse("state s{ invariant { x; y; z; } }");
} | rust_cleaned_test_functions.jsonl/91405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
1243,
15969,
741,
515,
18185,
21039,
445,
2454,
274,
90,
57620,
4687,
335,
797,
18185,
21039,
445,
2454,
274,
90,
57620,
856,
4687,
335,
797,
18185,
21039,
445,
2454,
274,
90,
57620,
42181,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_all_properties() {
let (vid, pid) = (0x1209, 0xb000);
let bootloader = Bootloader::try_new(vid, pid).unwrap();
insta::assert_debug_snapshot!(bootloader.all_properties());
} | rust_cleaned_test_functions.jsonl/107289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
25158,
368,
341,
1066,
262,
1077,
320,
1301,
11,
14814,
8,
284,
320,
15,
87,
16,
17,
15,
24,
11,
220,
15,
7929,
15,
15,
15,
317,
262,
1077,
88164,
284,
15004,
8355,
486,
1539,
5921,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_comment() {
let r = Registry::new();
assert_eq!(
r.render_template("Hello {{this}} {{! test me }}", &0)
.unwrap(),
"Hello 0 "
);
} | rust_cleaned_test_functions.jsonl/14271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17638,
368,
341,
262,
1077,
435,
284,
32112,
486,
931,
1428,
262,
2060,
10714,
33673,
286,
435,
8740,
8693,
445,
9707,
5867,
574,
3417,
5867,
0,
1273,
752,
3869,
497,
609,
15,
340,
310,
659,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_mavro_mean() {
let result = get_actual_result("test_csvs/Mavro.csv", "mean");
assert_abs_diff_eq!(result, 2.00185600000000, epsilon = mean_epsilon());
} | rust_cleaned_test_functions.jsonl/80547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
402,
299,
16933,
368,
341,
262,
1077,
1102,
284,
633,
40149,
5287,
445,
1944,
14020,
82,
10270,
402,
299,
11219,
497,
330,
14287,
797,
262,
2060,
31170,
15850,
10714,
10297,
1382,
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_cli_acc_no_breach() {
let res = Command::new("cargo")
.args(&["run", "acc", "fsrEos7s@wZ3zdGxr.com"])
.unwrap();
assert!(String::from_utf8_lossy(&res.stdout).contains("NO BREACH FOUND"));
} | rust_cleaned_test_functions.jsonl/13713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
17737,
6536,
880,
22606,
368,
341,
262,
1077,
592,
284,
7348,
486,
931,
445,
66715,
1138,
286,
659,
2116,
2099,
1183,
6108,
497,
330,
4475,
497,
330,
3848,
81,
36,
436,
22,
82,
31,
86,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exists_subquery() {
let mut model = Model::default();
let g_ids = (0..=1)
.map(|id| {
let g_id = model.make_box(qgm::get(id).into());
let mut b = model.get_mut_box(g_id);
b.add_column(exp::base(0, typ::int32(true)));
g_id
})
.collect::<Vec<_>>();
let s_id = model.make_box(Select::default().into());
let q_ids = vec![
model.make_quantifier(QuantifierType::Foreach, g_ids[0], s_id),
model.make_quantifier(QuantifierType::Existential, g_ids[1], s_id),
];
{
let mut b = model.get_mut_box(s_id);
// C0: Q0.0
b.add_column(exp::cref(q_ids[0], 0));
// C0: Q1.0
b.add_column(exp::cref(q_ids[1], 0));
}
for g_id in g_ids {
RejectedNulls.derive(&mut model, g_id);
RelationType.derive(&mut model, g_id);
}
RejectedNulls.derive(&mut model, s_id);
RelationType.derive(&mut model, s_id);
{
let b = model.get_box(s_id);
let act_value = b.attributes.get::<RelationType>();
let exp_value = &vec![typ::int32(true), typ::bool(false)];
assert_eq!(act_value, exp_value);
}
} | rust_cleaned_test_functions.jsonl/6658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 784
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9766,
5228,
1631,
368,
341,
286,
1077,
5206,
1614,
284,
4903,
486,
2258,
1428,
286,
1077,
342,
8077,
284,
320,
15,
496,
28,
16,
340,
310,
659,
2186,
22428,
307,
91,
341,
394,
1077,
342,
842,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_elem() {
// Test on-stack from_elem.
let mut v = vec![10, 10];
{
let v = v;
assert_eq!(v.len(), 2);
assert_eq!(v[0], 10);
assert_eq!(v[1], 10);
}
// Test on-heap from_elem.
v = vec![20; 6];
{
let v = &v[..];
assert_eq!(v[0], 20);
assert_eq!(v[1], 20);
assert_eq!(v[2], 20);
assert_eq!(v[3], 20);
assert_eq!(v[4], 20);
assert_eq!(v[5], 20);
}
} | rust_cleaned_test_functions.jsonl/12844 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
28179,
368,
341,
262,
442,
3393,
389,
56090,
504,
28179,
624,
262,
1077,
5206,
348,
284,
7486,
20703,
16,
15,
11,
220,
16,
15,
935,
262,
341,
286,
1077,
348,
284,
348,
280,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_linux() {
test(b"\x1b[[A", "\n");
test(b"\x1b[[Ahello\x1b[[Aworld\x1b[[A", "helloworld\n");
} | rust_cleaned_test_functions.jsonl/36869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77463,
368,
341,
262,
1273,
1883,
11934,
87,
16,
65,
15505,
32,
497,
2917,
77,
797,
262,
1273,
1883,
11934,
87,
16,
65,
15505,
32,
14990,
3462,
16,
65,
15505,
32,
14615,
3462,
16,
65,
15505,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ascii_chars() {
test(
"She got her education, then got rich programming: 👩🎓🎓👩💻💰",
"setnhm hrigpm eeoori gdnton outrgg tchir haeca",
);
} | rust_cleaned_test_functions.jsonl/27431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
21637,
50238,
37418,
368,
341,
262,
1273,
1006,
286,
330,
7941,
2684,
1059,
6731,
11,
1221,
2684,
9080,
15473,
25,
61804,
102,
378,
235,
145844,
145844,
145233,
378,
235,
145851,
145187,
756,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trapezoidal_integrate() {
let density = |_| LogProb(0.1f64.ln());
let prob = LogProb::ln_trapezoidal_integrate_exp(density, 0.0, 10.0, 5);
assert_relative_eq!(*prob, *LogProb::ln_one(), epsilon = 0.0000001);
} | rust_cleaned_test_functions.jsonl/59940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
2027,
89,
70816,
4042,
57017,
368,
341,
286,
1077,
17457,
284,
66091,
2835,
36980,
7,
15,
13,
16,
69,
21,
19,
918,
77,
1423,
286,
1077,
3566,
284,
2835,
36980,
486,
2261,
3547,
2027,
89,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_event_with_description_and_tags() {
let mut event = Event::new("error");
event.with_description("description");
event.with_tags(&["tag_1", "tag_2"]);
assert!(event
.into_query()
.build()
.unwrap()
.get()
.starts_with("event title=\"error\",description=\"description\",tags=\"tag_1,tag_2\" "))
} | rust_cleaned_test_functions.jsonl/77371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6748,
6615,
11448,
8378,
16333,
368,
341,
286,
1077,
5206,
1538,
284,
3665,
486,
931,
445,
841,
797,
286,
1538,
18164,
11448,
445,
4684,
797,
286,
1538,
18164,
16333,
2099,
1183,
4578,
62,
16,
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_find() {
assert_eq!("hello".find('l'), Some(2u));
assert_eq!("hello".find(|&: c:char| c == 'o'), Some(4u));
assert!("hello".find('x').is_none());
assert!("hello".find(|&: c:char| c == 'x').is_none());
assert_eq!("ประเทศไทย中华Việt Nam".find('华'), Some(30u));
assert_eq!("ประเทศไทย中华Việt Nam".find(|&: c: char| c == '华'), Some(30u));
} | rust_cleaned_test_functions.jsonl/2419 | {
"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,
21814,
368,
341,
286,
2060,
10714,
17223,
14990,
3263,
3903,
492,
75,
4567,
4329,
7,
17,
84,
1106,
286,
2060,
10714,
17223,
14990,
3263,
3903,
22428,
5,
25,
272,
25,
1762,
91,
272,
621,
364,
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_check_auth() -> Result<(), Error> {
let mut headers = HeaderMap::new();
headers.insert(AUTHORIZATION, HeaderValue::from_static("basic test_token"));
assert!(check("", &headers, Some(String::from("test_token"))).is_ok());
assert!(check("", &headers, Some(String::from("invalid_token"))).is_err());
assert!(check("", &headers, None).is_ok());
assert!(check("", &HeaderMap::new(), None).is_ok());
assert!(check("", &HeaderMap::new(), Some(String::from("token"))).is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/92787 | {
"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,
7200,
14014,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
7102,
284,
12104,
2227,
486,
931,
543,
286,
7102,
7030,
4346,
9153,
83278,
11,
12104,
1130,
486,
1499,
25360,
445,
22342,
1273,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ndarray1() {
let hw = RefCell::new(CpuHardware::new());
let src = ndarray::arr1(&iota(3));
let dest = src.into_array(&hw);
assert_eq!(*dest.shape(), Shape::new([3]));
assert_eq!(dest.get_values_f32(), iota(3));
} | rust_cleaned_test_functions.jsonl/73984 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
43544,
1653,
16,
368,
341,
262,
1077,
31256,
284,
8550,
3599,
486,
931,
3025,
5584,
66862,
486,
931,
1423,
262,
1077,
2286,
284,
66883,
486,
1118,
16,
2099,
72,
6089,
7,
18,
1106,
262,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_not_found() {
let (genesis_block, mint_keypair) = GenesisBlock::new(0);
let bank = Bank::new(&genesis_block);
let keypair = Keypair::new();
assert_eq!(
bank.transfer(1, &keypair, &mint_keypair.pubkey()),
Err(TransactionError::AccountNotFound)
);
assert_eq!(bank.transaction_count(), 0);
} | rust_cleaned_test_functions.jsonl/41885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
7913,
21480,
368,
341,
286,
1077,
320,
77894,
7113,
11,
28337,
3097,
12670,
8,
284,
40788,
4713,
486,
931,
7,
15,
317,
286,
1077,
6073,
284,
8547,
486,
931,
2099,
77894,
7113,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_two_nodes_operations() {
let env = init_cluster(1);
env.start(1, kvs_server(vec![]));
Admin::to(0, env.clone()).add_server(1).unwrap();
ensure_membership(Duration::from_secs(5), vec![0, 1], vec![0, 1], env.clone());
Client::to(0, env.clone()).set("a", "1").unwrap();
Client::to(1, env.clone()).set("b", "1").unwrap();
} | rust_cleaned_test_functions.jsonl/62211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
14896,
57345,
368,
341,
262,
1077,
6105,
284,
2930,
28441,
7,
16,
626,
262,
6105,
4962,
7,
16,
11,
595,
11562,
12015,
25592,
0,
1294,
3237,
262,
7582,
486,
983,
7,
15,
11,
6105,
15997,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multihash_error_digest_without_typenum() {
let input = quote! {
#[derive(Clone, Multihash)]
#[mh(alloc_size = U32)]
pub enum Code {
#[mh(code = 0x14, hasher = multihash::Sha2_256, digest = Sha2_256Digest)]
Sha2_256,
}
};
let derive_input = syn::parse2(input).unwrap();
let s = Structure::new(&derive_input);
multihash(s);
} | rust_cleaned_test_functions.jsonl/97859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26290,
6996,
988,
4096,
52994,
39904,
42111,
9018,
368,
341,
286,
1077,
1946,
284,
12641,
0,
341,
1843,
11506,
27098,
65297,
11,
22162,
6996,
988,
5563,
1843,
11506,
51916,
7,
4742,
2368,
284,
547... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mod_add() -> Result<(), PlonkError> {
test_mod_add_helper::<FqEd254>()?;
test_mod_add_helper::<FqEd377>()?;
test_mod_add_helper::<FqEd381>()?;
test_mod_add_helper::<Fq377>()
} | rust_cleaned_test_functions.jsonl/60294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
2891,
368,
1464,
5714,
68843,
1818,
263,
74,
1454,
29,
341,
286,
1273,
7480,
2891,
10418,
27638,
37,
80,
2715,
17,
20,
19,
13555,
37445,
286,
1273,
7480,
2891,
10418,
27638,
37,
80,
2715,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_statistics_min_max_bytes() {
let stats = Statistics::int32(Some(-123), Some(234), None, 1, false);
assert!(stats.has_min_max_set());
assert_eq!(stats.min_bytes(), (-123).as_bytes());
assert_eq!(stats.max_bytes(), 234.as_bytes());
let stats = Statistics::byte_array(
Some(ByteArray::from(vec![1, 2, 3])),
Some(ByteArray::from(vec![3, 4, 5])),
None,
1,
true,
);
assert!(stats.has_min_max_set());
assert_eq!(stats.min_bytes(), &[1, 2, 3]);
assert_eq!(stats.max_bytes(), &[3, 4, 5]);
} | rust_cleaned_test_functions.jsonl/15829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49569,
7260,
6345,
12524,
368,
341,
286,
1077,
10472,
284,
24624,
486,
396,
18,
17,
65405,
4080,
16,
17,
18,
701,
4329,
7,
17,
18,
19,
701,
2240,
11,
220,
16,
11,
895,
317,
286,
2060,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seq_iter() {
let gil = Python::acquire_gil();
let py = gil.python();
let v: Vec<i32> = vec![1, 1, 2, 3, 5, 8];
let ob = v.to_object(py);
let seq = ob.cast_as::<PySequence>(py).unwrap();
let mut idx = 0;
for el in seq.iter().unwrap() {
assert_eq!(v[idx], el.unwrap().extract::<i32>().unwrap());
idx += 1;
}
assert_eq!(idx, v.len());
} | rust_cleaned_test_functions.jsonl/47418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
11723,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
348,
25,
11312,
21897,
18,
17,
29,
284,
7486,
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_builder_inline() {
let expected = EmbedField {
inline: true,
name: "name".to_owned(),
value: "value".to_owned(),
};
let actual = EmbedFieldBuilder::new("name", "value").inline().build();
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/62785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
41871,
368,
341,
286,
1077,
3601,
284,
37068,
1877,
341,
310,
7381,
25,
830,
345,
310,
829,
25,
330,
606,
3263,
983,
51973,
3148,
310,
897,
25,
330,
957,
3263,
983,
51973,
3148,
286,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pp_io() {
let string = "$";
let data = parse::value(string).unwrap().without_spans();
assert_eq!(data.write_pretty(40, &mut Vec::new()).is_ok(), true);
} | rust_cleaned_test_functions.jsonl/97797 | {
"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,
31600,
16939,
368,
341,
286,
1077,
914,
284,
5201,
876,
286,
1077,
821,
284,
4715,
486,
957,
3609,
568,
15454,
1005,
28996,
10123,
596,
1428,
286,
2060,
10714,
10297,
691,
3836,
620,
21322,
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 |
#[test]
fn test_function_declaration() {
assert_json_snapshot!(
parse_function_declaration(
r#"function a() {
"use strict"
return 1
}"#
.into()
)
.unwrap()
.1
);
assert_json_snapshot!(
parse_function_declaration(r#"function a() {}"#.into())
.unwrap()
.1
);
assert_json_snapshot!(
parse_function_declaration(r#"function a(param1, param2) {}"#.into())
.unwrap()
.1
);
assert_json_snapshot!(
parse_function_declaration(r#"function a(param1, param2,) {}"#.into())
.unwrap()
.1
);
assert_json_snapshot!(
parse_function_declaration(
r#"function a() {
"use strict"
"also directive"
a;
"not directive"
return 1
}"#
.into()
)
.unwrap()
.1
);
assert_json_snapshot!(
parse_function_declaration(
r#"function fib() {
if (x === 0) return 0;
else if (x === 1) return 1;
else return fib(x - 1) + fib(x - 2);
}"#
.into()
)
.unwrap()
.1
);
assert_json_snapshot!(
parse_program(
r#"function foo() {
// stuff
}; foo();"#
.into()
)
.unwrap()
.1
);
} | rust_cleaned_test_functions.jsonl/13284 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
77926,
368,
341,
286,
2060,
9455,
53265,
33673,
310,
4715,
9174,
77926,
1006,
394,
435,
55543,
1688,
264,
368,
341,
503,
330,
810,
7304,
698,
503,
470,
220,
16,
198,
394,
335,
1,
4956,
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_to_classical_format() {
// long vowels
let og = Orthographia::try_from_ascii("i'nfa'ns").unwrap();
assert_eq!("INFANS", og.to_classical_format());
let og = Orthographia::try_from_ascii("Ju'ppiter").unwrap();
assert_eq!("IVPPITER", og.to_classical_format());
// semivowel j
let og = Orthographia::try_from_ascii("jam").unwrap();
assert_eq!("IAM", og.to_classical_format());
// semivowel v and vowel u
let og = Orthographia::try_from_ascii("ve'r|um").unwrap();
assert_eq!("VERVM", og.to_classical_format());
// compound word
let og = Orthographia::try_from_ascii("duo-decim").unwrap();
assert_eq!("DVODECIM", og.to_classical_format());
// stem
let og = Orthographia::try_from_ascii("magn|").unwrap();
assert_eq!("MAGN-", og.to_classical_format());
// word ending
let og = Orthographia::try_from_ascii("|ibus").unwrap();
assert_eq!("-IBVS", og.to_classical_format());
// word ending with additional separator
let og = Orthographia::try_from_ascii("|eri|mus").unwrap();
assert_eq!("-ERIMVS", og.to_classical_format());
// suffix
let og = Orthographia::try_from_ascii("-que").unwrap();
assert_eq!("-QVE", og.to_classical_format());
} | rust_cleaned_test_functions.jsonl/102152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 554
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
4790,
938,
8955,
368,
341,
262,
442,
1293,
78456,
198,
262,
1077,
7350,
284,
31110,
3178,
685,
486,
1539,
5673,
50238,
445,
72,
43786,
3632,
6,
4412,
1827,
15454,
543,
262,
2060,
10714,
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_raw_fd() {
let _tap_ip_guard = TAP_IP_LOCK.lock().unwrap();
let tap = Tap::new(1).unwrap();
assert_eq!(tap.as_raw_fd(), tap.tap_file.as_raw_fd());
} | rust_cleaned_test_functions.jsonl/55546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
17676,
368,
341,
286,
1077,
716,
30047,
10385,
36796,
284,
350,
2537,
16607,
27661,
21003,
1005,
15454,
1428,
286,
1077,
15239,
284,
36134,
486,
931,
7,
16,
568,
15454,
543,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_valid_cloudfront_list_invalidations() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"cloudfront-list-invalidations.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
CloudFrontClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = ListInvalidationsRequest::default();
let result = client.list_invalidations(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/44884 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
37356,
6951,
2019,
31433,
804,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
12361,
6951,
9029,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_init() {
// New block device
let mut block = Block::default();
assert_eq!(block.disk_sectors, 0);
assert_eq!(block.state.device_features, 0);
assert_eq!(block.state.driver_features, 0);
assert_eq!(block.state.config_space.len(), 16);
assert!(block.disk_image.is_none());
assert!(block.interrupt_cb.is_none());
assert!(block.sender.is_none());
// Realize block device: create TempFile as backing file.
block.blk_cfg.read_only = true;
block.blk_cfg.direct = false;
let f = TempFile::new().unwrap();
block.blk_cfg.path_on_host = f.as_path().to_str().unwrap().to_string();
assert!(block.realize().is_ok());
assert_eq!(block.device_type(), VIRTIO_TYPE_BLOCK);
assert_eq!(block.queue_num(), QUEUE_NUM_BLK);
assert_eq!(block.queue_size(), QUEUE_SIZE_BLK);
} | rust_cleaned_test_functions.jsonl/102127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
6137,
368,
341,
286,
442,
1532,
2504,
3671,
198,
286,
1077,
5206,
2504,
284,
8362,
486,
2258,
543,
286,
2060,
10714,
10297,
4574,
86211,
3453,
12532,
11,
220,
15,
317,
286,
2060,
10714,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_termination() -> Result<()> {
set_rustflags();
let expr = FilteringExpr::parse("test(=test_slow_timeout)", &*PACKAGE_GRAPH).unwrap();
let test_filter = TestFilterBuilder::new(
RunIgnored::IgnoredOnly,
None,
Vec::<String>::new(),
vec![expr],
);
let test_list = FIXTURE_TARGETS.make_test_list(&test_filter, &TargetRunner::empty());
let config =
NextestConfig::from_sources(&workspace_root(), None).expect("loaded fixture config");
let profile = config
.profile("with-termination")
.expect("with-termination config is valid");
let runner = TestRunnerBuilder::default().build(
&test_list,
&profile,
SignalHandler::noop(),
TargetRunner::empty(),
);
let (instance_statuses, run_stats) = execute_collect(&runner);
assert_eq!(run_stats.timed_out, 1, "1 test timed out");
let (_, instance_value) = instance_statuses
.iter()
.find(|(&(_, name), _)| name == "test_slow_timeout")
.expect("test_slow_timeout should be present");
let valid = match &instance_value.status {
InstanceStatus::Skipped(_) => panic!("test_slow_timeout should have been run"),
InstanceStatus::Finished(run_statuses) => {
// This test should not have been retried since retries aren't configured.
assert_eq!(
run_statuses.len(),
1,
"test_slow_timeout should have been run exactly once",
);
let run_status = run_statuses.last_status();
run_status.result == ExecutionResult::Timeout
}
};
if !valid {
panic!(
"for test_slow_timeout, mismatch in status: expected timeout, actual {:?}",
instance_value.status
);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/118819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 797
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
88676,
368,
1464,
5714,
71698,
341,
262,
738,
1710,
590,
11161,
1428,
262,
1077,
15169,
284,
81531,
16041,
486,
6400,
445,
1944,
7,
28,
1944,
82447,
20537,
11583,
609,
9,
61989,
58360,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_hash_prime() {
let mut rng = thread_rng();
for i in 1..10 {
let mut val = vec![0u8; i * 32];
rng.fill(&mut val[..]);
let h = hash_prime::<_, Blake2b>(&val);
assert!(probably_prime(&h, 20));
}
} | rust_cleaned_test_functions.jsonl/49433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
38217,
368,
341,
286,
1077,
5206,
28422,
284,
4516,
66849,
1428,
286,
369,
600,
304,
220,
16,
496,
16,
15,
341,
310,
1077,
5206,
1044,
284,
7486,
20703,
15,
84,
23,
26,
600,
353,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.