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_add_native_program() {
let (mut genesis_config, _mint_keypair) = create_genesis_config(100_000);
activate_all_features(&mut genesis_config);
let slot = 123;
let program_id = solana_sdk::pubkey::new_rand();
let bank = Arc::new(Bank::new_from_parent(
&Arc::new(Bank::new(&genesis_config)),
&Pubkey::default(),
slot,
));
assert_eq!(bank.get_account_modified_slot(&program_id), None);
assert_capitalization_diff(
&bank,
|| bank.add_native_program("mock_program", &program_id, false),
|old, new| {
assert_eq!(old + 1, new);
},
);
assert_eq!(bank.get_account_modified_slot(&program_id).unwrap().1, slot);
let bank = Arc::new(new_from_parent(&bank));
assert_capitalization_diff(
&bank,
|| bank.add_native_program("mock_program", &program_id, false),
|old, new| assert_eq!(old, new),
);
assert_eq!(bank.get_account_modified_slot(&program_id).unwrap().1, slot);
let bank = Arc::new(new_from_parent(&bank));
// invocations.
assert_capitalization_diff(
&bank,
|| bank.add_native_program("mock_program v2", &program_id, true),
|old, new| assert_eq!(old, new),
);
assert_eq!(
bank.get_account_modified_slot(&program_id).unwrap().1,
bank.slot()
);
let bank = Arc::new(new_from_parent(&bank));
assert_capitalization_diff(
&bank,
|| bank.add_native_program("mock_program v2", &program_id, true),
|old, new| assert_eq!(old, new),
);
// replacing with same name shouldn't update account
assert_eq!(
bank.get_account_modified_slot(&program_id).unwrap().1,
bank.parent_slot()
);
} | rust_cleaned_test_functions.jsonl/2643 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 979
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
44494,
25096,
368,
341,
286,
1077,
320,
6984,
59366,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
15,
62,
15,
15,
15,
317,
286,
20276,
5705,
14965,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_integral_types() {
is_to_sql::<i8>();
is_to_sql::<i16>();
is_to_sql::<i32>();
is_to_sql::<i64>();
is_to_sql::<u8>();
is_to_sql::<u16>();
is_to_sql::<u32>();
} | rust_cleaned_test_functions.jsonl/124013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64076,
9763,
368,
341,
286,
374,
2346,
18063,
27638,
72,
23,
3913,
286,
374,
2346,
18063,
27638,
72,
16,
21,
3913,
286,
374,
2346,
18063,
27638,
72,
18,
17,
3913,
286,
374,
2346,
18063,
27638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_opcode() {
let mut test_vm = VM::new();
test_vm.registers[0].content = 500;
test_vm.registers[1].content = 500;
test_vm.registers[2].content = 0;
test_vm.registers[3].content = 1;
test_vm.registers[4].content = 4;
test_vm.program = vec![2, 2, 3, 4];
test_vm.run();
assert_eq!(test_vm.registers[4].content, 1000)
} | rust_cleaned_test_functions.jsonl/60341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
71319,
368,
341,
286,
1077,
5206,
1273,
39008,
284,
17792,
486,
931,
543,
286,
1273,
39008,
7031,
9303,
58,
15,
936,
1796,
284,
220,
20,
15,
15,
280,
286,
1273,
39008,
7031,
9303,
58,
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_fatten_works() {
let mut uut = FattenTest::new(WordOrder::MostSignificantFirst);
uut.clock.connect();
uut.fifo.data_in.connect();
uut.fifo.write.connect();
uut.fifo.read.connect();
uut.connect_all();
let mut sim = Simulation::new();
sim.add_clock(5, |x: &mut Box<FattenTest>| x.clock.next = !x.clock.val());
sim.add_testbench(move |mut sim: Sim<FattenTest>| {
let mut x = sim.init()?;
wait_clock_true!(sim, clock, x);
for datum in [
0xD_u32, 0xE, 0xA, 0xD, 0xB, 0xE, 0xE, 0xF, 0xC, 0xA, 0xF, 0xE, 0xB, 0xA, 0xB, 0xE,
] {
x = sim.watch(|x| !x.fifo.full.val(), x)?;
x.fifo.data_in.next = datum.into();
x.fifo.write.next = true;
wait_clock_cycle!(sim, clock, x);
x.fifo.write.next = false;
}
sim.done(x)
});
sim.add_testbench(move |mut sim: Sim<FattenTest>| {
let mut x = sim.init()?;
wait_clock_true!(sim, clock, x);
for datum in [0xDEADBEEF_u32, 0xCAFEBABE] {
x = sim.watch(|x| !x.fifo.empty.val(), x)?;
sim_assert!(sim, x.fifo.data_out.val() == Bits::<32>::from(datum), x);
x.fifo.read.next = true;
wait_clock_cycle!(sim, clock, x);
x.fifo.read.next = false;
}
sim.done(x)
});
sim.run_traced(
Box::new(uut),
100_000,
std::fs::File::create(vcd_path!("fattenn.vcd")).unwrap(),
)
.unwrap()
} | rust_cleaned_test_functions.jsonl/112111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 842
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
14456,
11498,
82,
368,
341,
262,
1077,
5206,
575,
332,
284,
434,
14456,
2271,
486,
931,
7,
10879,
4431,
486,
13319,
7264,
33728,
5338,
317,
262,
575,
332,
50546,
10800,
543,
262,
575,
332,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_init_with_imported_wallet_fails_with_different_params() {
settings::set_defaults();
settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE, "false");
let wallet_name = "test_init_with_imported_wallet_fails_with_different_params";
settings::set_config_value(settings::CONFIG_WALLET_NAME,wallet_name);
let exported_path = format!(r#"/tmp/{}"#, wallet_name);
let wallet_key = settings::get_config_value(settings::CONFIG_WALLET_KEY).unwrap();
let backup_key = settings::get_config_value(settings::CONFIG_WALLET_BACKUP_KEY).unwrap();
let different_wallet_name = "different_wallet_name";
let dir = export_test_wallet();
vcx_shutdown(true);
let import_config = json!({
settings::CONFIG_WALLET_NAME: wallet_name,
settings::CONFIG_WALLET_KEY: wallet_key,
settings::CONFIG_EXPORTED_WALLET_PATH: exported_path,
settings::CONFIG_WALLET_BACKUP_KEY: backup_key,
}).to_string();
import(&import_config).unwrap();
let content = json!({
"wallet_name": different_wallet_name,
"wallet_key": settings::TEST_WALLET_KEY
}).to_string();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init_with_config(cb.command_handle,
CString::new(content).unwrap().into_raw(),
Some(cb.get_callback())),
error::SUCCESS.code_num);
assert_eq!(cb.receive(Some(Duration::from_secs(10))).err(), Some(error::WALLET_NOT_FOUND.code_num));
delete_import_wallet_path(dir);
settings::set_config_value(settings::CONFIG_WALLET_NAME,wallet_name);
vcx_shutdown(true);
} | rust_cleaned_test_functions.jsonl/19806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 853
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
6615,
18434,
291,
62308,
761,
6209,
6615,
82741,
6745,
368,
341,
286,
5003,
486,
746,
42290,
543,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
14379,
11641,
8414,
11,
330,
3849,
797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_executor_execute_and_commit_chunk_restart() {
let mut rt = Runtime::new().unwrap();
let first_batch_size = 30;
let second_batch_size = 40;
let (chunks, ledger_info) = {
let first_batch_start = 1;
let second_batch_start = first_batch_start + first_batch_size;
create_transaction_chunks(vec![
first_batch_start..first_batch_start + first_batch_size,
second_batch_start..second_batch_start + second_batch_size,
])
};
let (mut config, _) = config_builder::test_config();
let storage_server = create_storage_server(&mut config);
let mut synced_trees;
// First we simulate syncing the first chunk of transactions.
{
let (executor, mut committed_trees) = create_executor(&config);
let storage_client = StorageReadServiceClient::new("localhost", config.storage.port);
executor
.execute_and_commit_chunk(
chunks[0].clone(),
ledger_info.clone(),
None,
&mut committed_trees,
)
.unwrap();
synced_trees = committed_trees;
let (_, li, _, _) = rt
.block_on(storage_client.update_to_latest_ledger_async(0, vec![]))
.unwrap();
assert_eq!(li.ledger_info().version(), 0);
assert_eq!(li.ledger_info().consensus_block_id(), *PRE_GENESIS_BLOCK_ID);
}
// Then we restart executor and resume to the next chunk.
{
let (executor, _) = create_executor(&config);
let storage_client = StorageReadServiceClient::new("localhost", config.storage.port);
executor
.execute_and_commit_chunk(
chunks[1].clone(),
ledger_info.clone(),
None,
&mut synced_trees,
)
.unwrap();
let (_, li, _, _) = rt
.block_on(storage_client.update_to_latest_ledger_async(0, vec![]))
.unwrap();
assert_eq!(li, ledger_info);
}
drop(storage_server);
} | rust_cleaned_test_functions.jsonl/54643 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 989
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81207,
44329,
8378,
36346,
30539,
69392,
368,
341,
262,
1077,
5206,
16677,
284,
10954,
486,
931,
1005,
15454,
543,
262,
1077,
1156,
14534,
2368,
284,
220,
18,
15,
280,
262,
1077,
2086,
14534,
2368... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_connection_customizer() {
static RELEASED: AtomicBool = ATOMIC_BOOL_INIT;
RELEASED.store(false, Ordering::SeqCst);
static DROPPED: AtomicBool = ATOMIC_BOOL_INIT;
DROPPED.store(false, Ordering::SeqCst);
struct Connection(i32);
impl Drop for Connection {
fn drop(&mut self) {
DROPPED.store(true, Ordering::SeqCst);
}
}
struct Handler;
impl ManageConnection for Handler {
type Connection = Connection;
type Error = Error;
fn connect(&self) -> Result<Connection, Error> {
Ok(Connection(0))
}
fn is_valid(&self, _: &mut Connection) -> Result<(), Error> {
Ok(())
}
fn has_broken(&self, _: &mut Connection) -> bool {
true
}
}
#[derive(Debug)]
struct Customizer;
impl CustomizeConnection<Connection, Error> for Customizer {
fn on_acquire(&self, conn: &mut Connection) -> Result<(), Error> {
if !DROPPED.load(Ordering::SeqCst) {
Err(Error)
} else {
conn.0 = 1;
Ok(())
}
}
fn on_release(&self, _: Connection) {
RELEASED.store(true, Ordering::SeqCst);
}
}
let pool = Pool::builder()
.connection_customizer(Box::new(Customizer))
.build(Handler)
.unwrap();
{
let conn = pool.get().unwrap();
assert_eq!(1, conn.0);
assert!(!RELEASED.load(Ordering::SeqCst));
assert!(DROPPED.load(Ordering::SeqCst));
}
assert!(RELEASED.load(Ordering::SeqCst));
} | rust_cleaned_test_functions.jsonl/6407 | {
"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,
15866,
15875,
3135,
368,
341,
262,
1099,
53034,
35,
25,
30316,
11233,
284,
7369,
51793,
32491,
14446,
280,
262,
53034,
35,
16114,
3576,
11,
68621,
486,
20183,
34,
267,
626,
262,
1099,
422,
1285,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_system() {
let builder = RomBuilder::new();
assert_eq!(builder.build_rom().system(), System::NES);
let mut builder = RomBuilder::new();
builder.set_vs();
assert_eq!(builder.build_rom().system(), System::Vs);
let mut builder = RomBuilder::new();
builder.set_pc10();
assert_eq!(builder.build_rom().system(), System::PC10);
} | rust_cleaned_test_functions.jsonl/104408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17687,
368,
972,
286,
1077,
7363,
284,
11774,
3297,
486,
931,
1647,
286,
2060,
10714,
10297,
17850,
13239,
81383,
1005,
8948,
1507,
739,
486,
71758,
3079,
286,
1077,
5206,
7363,
284,
11774,
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_fill_and_borrow() {
let lazycell = LazyCell::new();
assert!(!lazycell.filled());
lazycell.fill(1).unwrap();
assert!(lazycell.filled());
let value = lazycell.borrow();
assert_eq!(value, Some(&1));
let value = lazycell.get();
assert_eq!(value, Some(1));
} | rust_cleaned_test_functions.jsonl/5789 | {
"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,
30728,
8378,
880,
7768,
368,
341,
286,
1077,
64436,
3337,
613,
284,
44263,
3599,
486,
931,
1428,
286,
2060,
0,
3471,
75,
1370,
3337,
613,
833,
4374,
1423,
286,
64436,
3337,
613,
12467,
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_pop() {
macro_rules! t(
(s: $path:expr, $left:expr, $right:expr) => (
{
let pstr = $path;
let mut p = Path::new(pstr);
let result = p.pop();
let left = $left;
assert!(p.as_str() == Some(left),
"`{}`.pop() failed; expected remainder `{}`, found `{}`",
pstr, left, p.as_str().unwrap());
assert!(result == $right);
}
);
(b: $path:expr, $left:expr, $right:expr) => (
{
let mut p = Path::new($path);
let result = p.pop();
assert_eq!(p.as_vec(), $left);
assert!(result == $right);
}
)
)
t!(s: "a\\b\\c", "a\\b", true);
t!(s: "a", ".", true);
t!(s: ".", ".", false);
t!(s: "\\a", "\\", true);
t!(s: "\\", "\\", false);
t!(b: b"a\\b\\c", b"a\\b", true);
t!(b: b"a", b".", true);
t!(b: b".", b".", false);
t!(b: b"\\a", b"\\", true);
t!(b: b"\\", b"\\", false);
t!(s: "C:\\a\\b", "C:\\a", true);
t!(s: "C:\\a", "C:\\", true);
t!(s: "C:\\", "C:\\", false);
t!(s: "C:a\\b", "C:a", true);
t!(s: "C:a", "C:", true);
t!(s: "C:", "C:", false);
t!(s: "\\\\server\\share\\a\\b", "\\\\server\\share\\a", true);
t!(s: "\\\\server\\share\\a", "\\\\server\\share", true);
t!(s: "\\\\server\\share", "\\\\server\\share", false);
t!(s: "\\\\?\\a\\b\\c", "\\\\?\\a\\b", true);
t!(s: "\\\\?\\a\\b", "\\\\?\\a", true);
t!(s: "\\\\?\\a", "\\\\?\\a", false);
t!(s: "\\\\?\\C:\\a\\b", "\\\\?\\C:\\a", true);
t!(s: "\\\\?\\C:\\a", "\\\\?\\C:\\", true);
t!(s: "\\\\?\\C:\\", "\\\\?\\C:\\", false);
t!(s: "\\\\?\\UNC\\server\\share\\a\\b", "\\\\?\\UNC\\server\\share\\a", true);
t!(s: "\\\\?\\UNC\\server\\share\\a", "\\\\?\\UNC\\server\\share", true);
t!(s: "\\\\?\\UNC\\server\\share", "\\\\?\\UNC\\server\\share", false);
t!(s: "\\\\.\\a\\b\\c", "\\\\.\\a\\b", true);
t!(s: "\\\\.\\a\\b", "\\\\.\\a", true);
t!(s: "\\\\.\\a", "\\\\.\\a", false);
t!(s: "\\\\?\\a\\b\\", "\\\\?\\a", true);
} | rust_cleaned_test_functions.jsonl/102771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
368,
341,
286,
18072,
21407,
0,
259,
1006,
310,
320,
82,
25,
400,
2343,
96011,
11,
400,
2359,
96011,
11,
400,
1291,
96011,
8,
589,
2399,
394,
341,
503,
1077,
281,
495,
284,
400,
2343,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fn_commit_hook() -> Result<()> {
let db = Connection::open_in_memory()?;
fn hook() -> bool {
true
}
db.commit_hook(Some(hook));
db.execute_batch("BEGIN; CREATE TABLE foo (t TEXT); COMMIT;")
.unwrap_err();
Ok(())
} | rust_cleaned_test_functions.jsonl/34784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
36346,
32005,
368,
1464,
5714,
71698,
341,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
368,
69493,
286,
5168,
9704,
368,
1464,
1807,
341,
310,
830,
198,
286,
555,
286,
2927,
15728,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_size() {
let mut map = MemoryMap::new();
map.push_remap(0x1000.into(), 0x1000, 0.into());
map.push_remap(0x3000.into(), 0x1000, 0x2000.into());
map.push_remap(0x6000.into(), 0x2000, 0x3000.into());
assert_eq!(map.real_size(), 0x4000);
} | rust_cleaned_test_functions.jsonl/70014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
2368,
368,
341,
286,
1077,
5206,
2415,
284,
13850,
2227,
486,
931,
543,
286,
2415,
2552,
1288,
2186,
7,
15,
87,
16,
15,
15,
15,
39860,
1507,
220,
15,
87,
16,
15,
15,
15,
11,
220,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_authorization_with_no_signer() {
let builder = PlainNotificationBuilder::new("test");
let payload = builder.build("a_test_id", Default::default());
let client = Client::new(AlpnConnector::new(), None, Endpoint::Production);
let request = client.build_request(payload);
assert_eq!(None, request.headers().get(AUTHORIZATION));
} | rust_cleaned_test_functions.jsonl/109647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
22938,
2022,
6615,
6536,
11172,
261,
368,
341,
286,
1077,
7363,
284,
43199,
11196,
3297,
486,
931,
445,
1944,
797,
286,
1077,
7729,
284,
7363,
13239,
445,
64,
4452,
842,
497,
7899,
486,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_html_expression() {
let r = Registry::new();
let element = HtmlExpression(Box::new(HelperTemplate::with_path(Path::with_named_paths(
&["hello"],
))));
let mut out = StringOutput::new();
let mut m: BTreeMap<String, String> = BTreeMap::new();
let value = "world";
m.insert("hello".to_string(), value.to_string());
let ctx = Context::wraps(&m).unwrap();
{
let mut rc = RenderContext::new(None);
element.render(&r, &ctx, &mut rc, &mut out).ok().unwrap();
}
assert_eq!(out.into_string().unwrap(), value.to_string());
} | rust_cleaned_test_functions.jsonl/15107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9564,
28068,
368,
341,
262,
1077,
435,
284,
32112,
486,
931,
543,
262,
1077,
2392,
284,
19200,
9595,
67758,
486,
931,
7,
5511,
7275,
486,
4197,
2638,
33030,
486,
4197,
71834,
24152,
1006,
286,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_log_exec_empty() {
let l = Log::<Operation>::default();
let mut f = |_o: Operation, _i: usize| {
assert!(false);
};
l.exec(1, &mut f);
} | rust_cleaned_test_functions.jsonl/101055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
18430,
15124,
368,
341,
286,
1077,
326,
284,
2835,
27638,
8432,
6831,
2258,
543,
286,
1077,
5206,
282,
284,
70886,
78,
25,
16730,
11,
716,
72,
25,
22301,
91,
341,
310,
2060,
10297,
3849,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_seekable_mem_writer() {
let mut writer = Cursor::new(Vec::<u8>::new());
assert_eq!(writer.position(), 0);
assert_eq!(writer.write(&[0]).unwrap(), 1);
assert_eq!(writer.position(), 1);
assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3);
assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4);
assert_eq!(writer.position(), 8);
let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7];
assert_eq!(&writer.get_ref()[..], b);
assert_eq!(writer.seek(SeekFrom::Start(0)).unwrap(), 0);
assert_eq!(writer.position(), 0);
assert_eq!(writer.write(&[3, 4]).unwrap(), 2);
let b: &[_] = &[3, 4, 2, 3, 4, 5, 6, 7];
assert_eq!(&writer.get_ref()[..], b);
assert_eq!(writer.seek(SeekFrom::Current(1)).unwrap(), 3);
assert_eq!(writer.write(&[0, 1]).unwrap(), 2);
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 7];
assert_eq!(&writer.get_ref()[..], b);
assert_eq!(writer.seek(SeekFrom::End(-1)).unwrap(), 7);
assert_eq!(writer.write(&[1, 2]).unwrap(), 2);
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2];
assert_eq!(&writer.get_ref()[..], b);
assert_eq!(writer.seek(SeekFrom::End(1)).unwrap(), 10);
assert_eq!(writer.write(&[1]).unwrap(), 1);
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2, 0, 1];
assert_eq!(&writer.get_ref()[..], b);
} | rust_cleaned_test_functions.jsonl/4229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 734
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
480,
12976,
28908,
368,
341,
286,
1077,
5206,
6916,
284,
28067,
486,
931,
49923,
27638,
84,
23,
6831,
931,
1423,
286,
2060,
10714,
10297,
18189,
6187,
1507,
220,
15,
317,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_input_err() {
let mut serial = Serial::new_sink(EventFd::new(libc::EFD_NONBLOCK).unwrap());
let input = [0u8; FIFO_SIZE + 1];
serial.raw_input(&input).unwrap_err();
} | rust_cleaned_test_functions.jsonl/37140 | {
"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,
16067,
5898,
9266,
368,
341,
286,
1077,
5206,
6146,
284,
11215,
486,
931,
51567,
30469,
74476,
486,
931,
44828,
66,
486,
36,
14596,
22128,
39964,
568,
15454,
1423,
286,
1077,
1946,
284,
508,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_all_parameters_blake2b() {
let flags = [
"-b",
"--length=18",
"--key=626172",
"--salt=62617a62617a62617a62617a62617a62",
"--personal=62696e672062696e672062696e672062",
"--fanout=2",
"--max-depth=3",
"--max-leaf-length=67438087",
"--node-offset=579005069656919567",
"--node-depth=16",
"--inner-hash-length=17",
"--last-node",
];
let output = cmd(blake2_exe(), flags.iter())
.stdin_bytes("foo")
.read()
.expect("blake2 failed");
assert_eq!("ec0f59cb65f92e7fcca1280ba859a6925ded", output);
} | rust_cleaned_test_functions.jsonl/14819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
18263,
13141,
726,
17,
65,
368,
341,
262,
1077,
8042,
284,
2278,
286,
6523,
65,
756,
286,
14482,
4129,
28,
16,
23,
756,
286,
14482,
792,
28,
21,
17,
21,
16,
22,
17,
756,
286,
14482,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calculates_document_range() {
let mut scanner = Scanner::new("<?php ; \n; \n;");
scanner.scan().unwrap();
assert_eq!(NodeRange::new(0, 0, 1, 2), scanner.document_range());
} | rust_cleaned_test_functions.jsonl/52958 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
3314,
973,
26231,
9698,
368,
341,
286,
1077,
5206,
20775,
284,
17170,
486,
931,
98276,
1208,
2587,
1124,
77,
26,
1124,
77,
26,
3071,
286,
20775,
47949,
1005,
15454,
1428,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_renamed_field_struct() {
assert_de_tokens_error::<RenameStruct>(
&[
Token::Struct { name: "Superhero", len: 2 },
Token::Str("a1"),
Token::I32(1),
Token::StructEnd,
],
"missing field `a3`",
);
assert_de_tokens_error::<RenameStructSerializeDeserialize>(
&[
Token::Struct { name: "SuperheroDe", len: 2 },
Token::Str("a1"),
Token::I32(1),
Token::StructEnd,
],
"missing field `a5`",
);
} | rust_cleaned_test_functions.jsonl/58622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
1288,
30245,
5013,
15126,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
88757,
9422,
17055,
286,
609,
9640,
310,
9660,
486,
9422,
314,
829,
25,
330,
19284,
17732,
497,
2422,
25,
220,
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_add_assign_fails_on_nan_t_ref() {
let mut a = not_nan(std::f32::INFINITY);
let b = std::f32::NEG_INFINITY;
a += &b;
} | rust_cleaned_test_functions.jsonl/80095 | {
"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,
2891,
20688,
761,
6209,
4470,
73936,
528,
7793,
368,
341,
262,
1077,
5206,
264,
284,
537,
73936,
5194,
486,
69,
18,
17,
486,
687,
55990,
317,
262,
1077,
293,
284,
1460,
486,
69,
18,
17,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_runtime_update_balloon_stats_config() {
let req = VmmAction::UpdateBalloonStatistics(BalloonUpdateStatsConfig {
stats_polling_interval_s: 0,
});
check_runtime_request(req, |result, vmm| {
assert_eq!(result, Ok(VmmData::Empty));
assert!(vmm.update_balloon_stats_config_called)
});
let req = VmmAction::UpdateBalloonStatistics(BalloonUpdateStatsConfig {
stats_polling_interval_s: 0,
});
check_runtime_request_err(
req,
VmmActionError::BalloonConfig(BalloonConfigError::DeviceNotFound),
);
} | rust_cleaned_test_functions.jsonl/44545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33232,
8882,
56441,
31335,
15381,
5332,
368,
341,
286,
1077,
4232,
284,
647,
3821,
2512,
486,
4289,
37889,
31335,
38599,
5349,
278,
31335,
4289,
16635,
2648,
341,
310,
10472,
40002,
287,
20541,
643,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_channel_update_guild() {
let cache = InMemoryCache::new();
let (guild_id, channel_id, channel) = test::guild_channel_text();
cache.update(&ChannelUpdate(Channel::Guild(channel)));
assert_eq!(1, cache.channels_guild.len());
assert!(cache
.guild_channels
.get(&guild_id)
.unwrap()
.contains(&channel_id));
} | rust_cleaned_test_functions.jsonl/35014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14571,
8882,
1889,
1498,
368,
341,
286,
1077,
6500,
284,
758,
10642,
8233,
486,
931,
543,
286,
1077,
320,
57877,
842,
11,
5496,
842,
11,
5496,
8,
284,
1273,
486,
57877,
14571,
4326,
1428,
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_detect_compiler_kind_clang() {
let f = TestFixture::new();
let creator = new_creator();
let pool = ThreadPool::sized(1);
next_command(&creator, Ok(MockChild::new(exit_status(0), "clang\n", "")));
let c = detect_compiler(creator, &f.bins[0], f.tempdir.path(), &[], &pool, None)
.wait()
.unwrap()
.0;
assert_eq!(CompilerKind::C(CCompilerKind::Clang), c.kind());
} | rust_cleaned_test_functions.jsonl/61639 | {
"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,
56457,
80910,
33162,
6794,
524,
368,
341,
286,
1077,
282,
284,
3393,
18930,
486,
931,
543,
286,
1077,
19919,
284,
501,
68532,
543,
286,
1077,
7314,
284,
72716,
486,
82,
1506,
7,
16,
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_downcast() {
use std::any::Any;
let r1: Rc<Any> = Rc::new(i32::max_value());
let r2: Rc<Any> = Rc::new("abc");
assert!(r1.clone().downcast::<u32>().is_err());
let r1i32 = r1.downcast::<i32>();
assert!(r1i32.is_ok());
assert_eq!(r1i32.unwrap(), Rc::new(i32::max_value()));
assert!(r2.clone().downcast::<i32>().is_err());
let r2str = r2.downcast::<&'static str>();
assert!(r2str.is_ok());
assert_eq!(r2str.unwrap(), Rc::new("abc"));
} | rust_cleaned_test_functions.jsonl/4679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13998,
3829,
368,
341,
286,
990,
1460,
486,
3767,
486,
8610,
401,
286,
1077,
435,
16,
25,
81463,
86712,
29,
284,
81463,
486,
931,
1956,
18,
17,
486,
2810,
3142,
1423,
286,
1077,
435,
17,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update() {
for b in IPV4_HEADERS {
let mut buf = Vec::new();
buf.extend_from_slice(b);
let mut c = Checksum::new();
c.add_bytes(&buf);
assert_eq!(c.checksum(), 0);
// replace the destination IP with the loopback address
let old = [buf[16], buf[17], buf[18], buf[19]];
(&mut buf[16..20]).copy_from_slice(&[127, 0, 0, 1]);
let updated = update(c.checksum(), &old, &[127, 0, 0, 1]);
let from_scratch = {
let mut c = Checksum::new();
c.add_bytes(&buf);
c.checksum()
};
assert_eq!(updated, from_scratch);
}
// Test update with bytes big enough to test simd implementation with
// overflow.
const BUF_LEN: usize = (1 << 20) + 79;
let buf = vec![0xFF; BUF_LEN];
let mut new_buf = buf.to_vec();
let (begin, end) = (4, BUF_LEN);
for i in begin..end {
new_buf[i] = i as u8;
}
let updated = {
let mut c = Checksum::new();
c.add_bytes(&buf);
update(c.checksum(), &buf[begin..end], &new_buf[begin..end])
};
let from_scratch = {
let mut c = Checksum::new();
c.add_bytes(&new_buf);
c.checksum()
};
assert_eq!(updated, from_scratch);
} | rust_cleaned_test_functions.jsonl/113594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 783
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
368,
341,
286,
369,
293,
304,
91498,
19,
79428,
341,
310,
1077,
5206,
6607,
284,
11312,
486,
931,
543,
310,
6607,
15831,
5673,
26488,
1883,
626,
310,
1077,
5206,
272,
284,
4248,
1242,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_date_rfc_3339() {
let scene = TestScenario::new(util_name!());
let mut result = scene.ucmd().arg("--rfc-3339=ns").succeeds();
// Check that the output matches the regexp
let rfc_regexp = r"(\d+)-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])\s([01]\d|2[0-3]):([0-5]\d):([0-5]\d|60)(\.\d+)?(([Zz])|([\+|\-]([01]\d|2[0-3])))";
let re = Regex::new(rfc_regexp).unwrap();
assert!(re.is_match(&result.stdout.trim()));
result = scene.ucmd().arg("--rfc-3339=seconds").succeeds();
// Check that the output matches the regexp
let re = Regex::new(rfc_regexp).unwrap();
assert!(re.is_match(&result.stdout.trim()));
} | rust_cleaned_test_functions.jsonl/25488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
1710,
8316,
62,
18,
18,
18,
24,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
5231,
262,
1077,
5206,
1102,
284,
6109,
56334,
2277,
1005,
858,
21549,
8052,
66,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enum_after_space() {
check(
r#"
enum Foo $0{
A,
B(),
C{},
}
fn main() {
let f: Foo;
f = Foo::A;
f = Foo::B();
f = Foo::C{};
}
"#,
expect![[r#"
Foo Enum FileId(0) 0..37 5..8
FileId(0) 74..77
FileId(0) 90..93
FileId(0) 108..111
"#]],
);
} | rust_cleaned_test_functions.jsonl/60635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
19844,
14663,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
9018,
33428,
400,
15,
515,
262,
362,
345,
262,
425,
3148,
262,
356,
38837,
532,
8822,
1887,
368,
341,
262,
1077,
282,
25,
3342... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_column_writer_dictionary_disabled_v1() {
let props = WriterProperties::builder()
.set_writer_version(WriterVersion::PARQUET_1_0)
.set_dictionary_enabled(false)
.build();
column_roundtrip_random::<Int32Type>(
props,
1024,
std::i32::MIN,
std::i32::MAX,
10,
10,
);
} | rust_cleaned_test_functions.jsonl/85658 | {
"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,
8744,
28908,
42605,
51401,
2273,
16,
368,
341,
286,
1077,
6914,
284,
29404,
7903,
486,
17850,
741,
310,
659,
746,
28908,
9438,
7,
6492,
5637,
486,
16567,
5757,
1348,
62,
16,
62,
15,
340,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_retransmit_large() {
let num_nodes = 4000;
let stakes: Vec<_> = (0..num_nodes).collect();
run_simulation(&stakes, 2);
} | rust_cleaned_test_functions.jsonl/64215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
1458,
1763,
45228,
368,
341,
262,
1077,
1629,
14896,
284,
220,
19,
15,
15,
15,
280,
262,
1077,
44425,
25,
11312,
32399,
29,
284,
320,
15,
496,
2413,
14896,
568,
17384,
543,
262,
1598,
82... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_signal_return_expected_object_type() {
let obj = Object::with_type(SimpleObject::static_type(), &[]).expect("Object::new failed");
obj.connect("create-child-object", false, move |_args| {
Some(
Object::with_type(ChildObject::static_type(), &[])
.expect("Object::new failed")
.to_value(),
)
});
let value: glib::Object = obj.emit_by_name("create-child-object", &[]);
assert!(value.type_().is_a(ChildObject::static_type()));
} | rust_cleaned_test_functions.jsonl/9016 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21137,
12511,
32190,
5314,
1819,
368,
341,
286,
1077,
2839,
284,
3002,
486,
4197,
1819,
3759,
6456,
1190,
486,
1978,
1819,
1507,
609,
1294,
568,
17119,
445,
1190,
486,
931,
4641,
3071,
286,
2839,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_rule_partial() {
let rule: BinProtRule = serde_json::from_str(RECORD_RULE).unwrap();
let example = vec![0x05, 0x00, 0x01];
#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct PartialType {
first: u8,
second: Value,
third: bool,
}
let mut de = Deserializer::from_reader(Cursor::new(example.as_slice())).with_layout(&rule);
let result: PartialType = Deserialize::deserialize(&mut de).expect("Failed to deserialize");
assert_eq!(
result,
PartialType {
first: 5,
second: Value::Record(vec![("inner".to_string(), Value::Bool(false))]),
third: true
}
);
test_reserialize(&result, &example);
} | rust_cleaned_test_functions.jsonl/134752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
21124,
52068,
368,
341,
286,
1077,
5912,
25,
29344,
12423,
11337,
284,
61570,
9455,
486,
1499,
2895,
43202,
23860,
50495,
568,
15454,
543,
286,
1077,
3110,
284,
7486,
20703,
15,
87,
15,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_ruby_stack_trace_2_1_6() {
let current_thread_addr = 0x562658abd7f0;
let stack_trace = ruby_version::ruby_2_1_6::get_stack_trace::<CoreDump>(
current_thread_addr,
0,
None,
&coredump_2_1_6(),
0,
)
.unwrap();
assert_eq!(real_stack_trace_main(), stack_trace.trace);
} | rust_cleaned_test_functions.jsonl/715 | {
"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,
3062,
1710,
20028,
15528,
23575,
62,
17,
62,
16,
62,
21,
368,
341,
286,
1077,
1482,
10814,
7387,
284,
220,
15,
87,
20,
21,
17,
21,
20,
23,
85920,
22,
69,
15,
280,
286,
1077,
5611,
23575,
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_change_admin() {
let mut service = TestService::new();
let caller = TestService::caller();
let ctx = mock_context(caller.clone());
let changed = service.change_admin(ctx, ChangeAdminPayload {
addr: caller.clone(),
});
assert!(changed.is_error());
let ctx = mock_context(TestService::admin());
service_call!(service, change_admin, ctx, ChangeAdminPayload {
addr: caller.clone(),
});
assert_eq!(service.admin(), caller);
} | rust_cleaned_test_functions.jsonl/27232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15947,
12207,
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,
5231,
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_rand() {
let mut rng = task_rng();
let _n: BigUint = rng.gen_biguint(137);
assert!(rng.gen_biguint(0).is_zero());
} | rust_cleaned_test_functions.jsonl/96914 | {
"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,
33864,
368,
341,
286,
1077,
5206,
28422,
284,
3383,
66849,
543,
286,
1077,
716,
77,
25,
6164,
21570,
284,
28422,
22822,
36386,
2496,
7,
16,
18,
22,
317,
286,
2060,
10297,
69890,
22822,
36386,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_export_bip44() {
let descriptor = "wpkh(xprv9s21ZrQH143K4CTb63EaMxja1YiTnSEWKMbn23uoEnAzxjdUJRQkazCAtzxGm4LSoTSVTptoV9RbchnKPW9HxKtZumdyxyikZFDLhogJ5Uj/44'/0'/0'/0/*)";
let change_descriptor = "wpkh(xprv9s21ZrQH143K4CTb63EaMxja1YiTnSEWKMbn23uoEnAzxjdUJRQkazCAtzxGm4LSoTSVTptoV9RbchnKPW9HxKtZumdyxyikZFDLhogJ5Uj/44'/0'/0'/1/*)";
let wallet = Wallet::new_offline(
descriptor,
Some(change_descriptor),
Network::Bitcoin,
get_test_db(),
)
.unwrap();
let export = WalletExport::export_wallet(&wallet, "Test Label", true).unwrap();
assert_eq!(export.descriptor(), descriptor);
assert_eq!(export.change_descriptor(), Some(change_descriptor.into()));
assert_eq!(export.blockheight, 5000);
assert_eq!(export.label, "Test Label");
} | rust_cleaned_test_functions.jsonl/21473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27114,
880,
573,
19,
19,
368,
341,
286,
1077,
16414,
284,
330,
8421,
30664,
2075,
649,
85,
24,
82,
17,
16,
57,
81,
48,
39,
16,
19,
18,
42,
19,
1162,
65,
21,
18,
36,
64,
44,
87,
5580,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_invalid_signature() {
let (config, key) = config_builder::test_config();
let vm_validator = TestValidator::new(&config);
let mut rng = ::rand::rngs::StdRng::from_seed([1u8; 32]);
let other_private_key = Ed25519PrivateKey::generate(&mut rng);
// Submit with an account using an different private/public keypair
let address = account_config::libra_root_address();
let program =
encode_peer_to_peer_with_metadata_script(lbr_type_tag(), address, 100, vec![], vec![]);
let transaction = transaction_test_helpers::get_test_unchecked_txn(
address,
1,
&other_private_key,
key.public_key(),
Some(program),
);
let ret = vm_validator.validate_transaction(transaction).unwrap();
assert_eq!(
ret.status().unwrap().major_status,
StatusCode::INVALID_SIGNATURE
);
} | rust_cleaned_test_functions.jsonl/56934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
31433,
39859,
368,
341,
262,
1077,
320,
1676,
11,
1376,
8,
284,
2193,
28532,
486,
1944,
5332,
543,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
2099,
1676,
626,
262,
1077,
5206,
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_woff2_transformed_glyf_table_composite_glyph_counts() {
with_woff2_glyf_table("tests/fonts/woff2/SFNT-TTF-Composite.woff2", |glyf| {
let glyph_counts = glyf.records.iter().fold(
(0, 0, 0),
|(empty, simple, composite), record| match record {
GlyfRecord::Empty => (empty + 1, simple, composite),
GlyfRecord::Parsed(Glyph {
data: GlyphData::Simple(_),
..
}) => (empty, simple + 1, composite),
GlyfRecord::Parsed(Glyph {
data: GlyphData::Composite { .. },
..
}) => (empty, simple, composite + 1),
GlyfRecord::Present(_) => unreachable!(),
},
);
assert_eq!(glyph_counts, (2, 8, 2))
});
} | rust_cleaned_test_functions.jsonl/40129 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
68585,
17,
18449,
291,
1889,
398,
69,
5237,
2965,
13607,
88703,
25977,
368,
341,
262,
448,
62,
68585,
17,
1889,
398,
69,
5237,
445,
23841,
60667,
14,
68585,
17,
11374,
37,
6408,
9285,
10808,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_prune_out_of_bounds() {
let blocktree_path = get_tmp_ledger_path!();
let blocktree = Blocktree::open(&blocktree_path).unwrap();
blocktree.prune(5);
drop(blocktree);
Blocktree::destroy(&blocktree_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/116899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
2886,
6068,
3575,
36878,
368,
341,
286,
1077,
2504,
9344,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
1077,
2504,
9344,
284,
8362,
9344,
486,
2508,
2099,
4574,
9344,
2638,
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... | 1 |
#[test]
fn test_buffer_issues() {
let params: NoiseParams = "Noise_NN_25519_AESGCM_SHA256".parse().unwrap();
let mut h_i = Builder::new(params.clone()).build_initiator().unwrap();
let mut h_r = Builder::new(params).build_responder().unwrap();
let mut buffer_msg = [0u8; 200];
let mut buffer_out = [0u8; 2];
let len = h_i.write_message(b"abc", &mut buffer_msg).unwrap();
let res = h_r.read_message(&buffer_msg[..len], &mut buffer_out);
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/27114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
90232,
368,
341,
262,
1077,
3628,
25,
50523,
4870,
284,
330,
61819,
1604,
45,
62,
17,
20,
20,
16,
24,
69381,
38,
9985,
38096,
17,
20,
21,
3263,
6400,
1005,
15454,
543,
262,
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_pessimistic_lock_check_epoch() {
let mut cluster = new_server_cluster(0, 2);
cluster.cfg.pessimistic_txn.pipelined = true;
cluster.cfg.pessimistic_txn.in_memory = true;
cluster.run();
cluster.must_transfer_leader(1, new_peer(1, 1));
let region = cluster.get_region(b"");
let leader = region.get_peers()[0].clone();
let epoch = cluster.get_region_epoch(region.id);
let mut ctx = Context::default();
ctx.set_region_id(region.id);
ctx.set_peer(leader.clone());
ctx.set_region_epoch(epoch);
fail::cfg("acquire_pessimistic_lock", "pause").unwrap();
let env = Arc::new(Environment::new(1));
let channel =
ChannelBuilder::new(env).connect(&cluster.sim.rl().get_addr(leader.get_store_id()));
let client = TikvClient::new(channel);
let mut ctx = Context::default();
ctx.set_region_id(region.get_id());
ctx.set_region_epoch(region.get_region_epoch().clone());
ctx.set_peer(leader);
let mut mutation = pb::Mutation::default();
mutation.set_op(Op::PessimisticLock);
mutation.key = b"key".to_vec();
let mut req = PessimisticLockRequest::default();
req.set_context(ctx.clone());
req.set_mutations(vec![mutation].into());
req.set_start_version(10);
req.set_for_update_ts(10);
req.set_primary_lock(b"key".to_vec());
let lock_resp = thread::spawn(move || client.kv_pessimistic_lock(&req).unwrap());
thread::sleep(Duration::from_millis(300));
cluster.must_transfer_leader(1, new_peer(2, 2));
cluster.must_transfer_leader(1, new_peer(1, 1));
fail::remove("acquire_pessimistic_lock");
let resp = lock_resp.join().unwrap();
assert!(resp.get_region_error().has_stale_command());
} | rust_cleaned_test_functions.jsonl/8372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 710
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
66733,
4532,
9818,
7200,
20682,
368,
341,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
15,
11,
220,
17,
317,
262,
10652,
30481,
556,
66733,
4532,
92299,
556,
81079,
1589,
284,
830,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_declaration_order() {
let map = important_cities();
let actual_entries = map.iter()
.map(|(&state, &city)| (state, city))
.collect::<Vec<_>>();
let declared_entries = actual_entries.iter()
.cloned()
.sorted()
.collect_vec();
assert_eq!(actual_entries, declared_entries);
let reversed_map = actual_entries.iter().rev()
.cloned()
.collect::<DirectIdMap<KnownState, &'static str>>();
let reversed_entries = reversed_map.iter()
.map(|(&state, &city)| (state, city))
.collect::<Vec<_>>();
assert_eq!(reversed_entries, declared_entries);
} | rust_cleaned_test_functions.jsonl/38662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77926,
7869,
368,
341,
262,
1077,
2415,
284,
2989,
666,
1361,
543,
262,
1077,
5042,
26092,
284,
2415,
19471,
741,
286,
659,
2186,
22428,
2099,
2454,
11,
609,
8926,
17935,
320,
2454,
11,
3283,
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_try_from_get_mmds() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
sender
.write_all(http_request("GET", "/mmds", None).as_bytes())
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
assert!(ParsedRequest::try_from_request(&req).is_ok());
} | rust_cleaned_test_functions.jsonl/106575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
3062,
717,
2277,
82,
368,
341,
286,
1077,
320,
6984,
4646,
11,
13964,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5206,
3633,
284,
4823,
4526,
486,
931,
78126,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cfg_and() {
with_globals(|| {
let mut x = Cfg::False;
x &= Cfg::True;
assert_eq!(x, Cfg::False);
x = word_cfg("test");
x &= Cfg::False;
assert_eq!(x, Cfg::False);
x = word_cfg("test2");
x &= Cfg::True;
assert_eq!(x, word_cfg("test2"));
x = Cfg::True;
x &= word_cfg("test3");
assert_eq!(x, word_cfg("test3"));
x &= word_cfg("test4");
assert_eq!(x, Cfg::All(vec![word_cfg("test3"), word_cfg("test4")]));
x &= word_cfg("test5");
assert_eq!(x, Cfg::All(vec![word_cfg("test3"), word_cfg("test4"), word_cfg("test5")]));
x &= Cfg::All(vec![word_cfg("test6"), word_cfg("test7")]);
assert_eq!(x, Cfg::All(vec![
word_cfg("test3"),
word_cfg("test4"),
word_cfg("test5"),
word_cfg("test6"),
word_cfg("test7"),
]));
let mut y = Cfg::Any(vec![word_cfg("a"), word_cfg("b")]);
y &= x;
assert_eq!(y, Cfg::All(vec![
word_cfg("test3"),
word_cfg("test4"),
word_cfg("test5"),
word_cfg("test6"),
word_cfg("test7"),
Cfg::Any(vec![word_cfg("a"), word_cfg("b")]),
]));
assert_eq!(
word_cfg("a") & word_cfg("b") & word_cfg("c"),
Cfg::All(vec![word_cfg("a"), word_cfg("b"), word_cfg("c")])
);
})
} | rust_cleaned_test_functions.jsonl/53554 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1001
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18343,
8378,
368,
341,
286,
448,
58775,
79453,
341,
310,
1077,
5206,
856,
284,
356,
4817,
486,
4049,
280,
310,
856,
14581,
356,
4817,
486,
2514,
280,
310,
2060,
10714,
10297,
87,
11,
356,
4817,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_let_if() {
let t = LetIfTemplate { cond: true }; // instantiate your struct
assert_eq!("Hello, true false foo!", t.call().unwrap()); // then call it.
} | rust_cleaned_test_functions.jsonl/92837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
1149,
11119,
368,
341,
262,
1077,
259,
284,
6771,
2679,
7275,
314,
9756,
25,
830,
20066,
442,
40902,
697,
2036,
198,
262,
2060,
10714,
17223,
9707,
11,
830,
895,
15229,
18789,
259,
8524,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_do_not_graft_within_backoff_period() {
let config = GossipsubConfigBuilder::default()
.backoff_slack(1)
.heartbeat_interval(Duration::from_millis(100))
.build()
.unwrap();
//only one peer => mesh too small and will try to regraft as early as possible
let (mut gs, peers, topics) = inject_nodes1()
.peer_no(1)
.topics(vec!["test".into()])
.to_subscribe(true)
.gs_config(config)
.create_network();
//handle prune from peer with backoff of one second
gs.handle_prune(&peers[0], vec![(topics[0].clone(), Vec::new(), Some(1))]);
//forget all events until now
flush_events(&mut gs);
//call heartbeat
gs.heartbeat();
for _ in 0..10 {
sleep(Duration::from_millis(100));
gs.heartbeat();
}
//Check that no graft got created (we have backoff_slack = 1 therefore one more heartbeat
assert_eq!(
count_control_msgs(&gs, |_, m| match m {
GossipsubControlAction::Graft { .. } => true,
_ => false,
}),
0,
"Graft message created too early within backoff period"
);
//Heartbeat one more time this should graft now
sleep(Duration::from_millis(100));
gs.heartbeat();
//check that graft got created
assert!(
count_control_msgs(&gs, |_, m| match m {
GossipsubControlAction::Graft { .. } => true,
_ => false,
}) > 0,
"No graft message was created after backoff period"
);
} | rust_cleaned_test_functions.jsonl/66900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 871
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26309,
7913,
15682,
64,
723,
72385,
3895,
1847,
20818,
368,
341,
286,
1077,
2193,
284,
479,
41473,
1966,
2648,
3297,
486,
2258,
741,
310,
659,
1419,
1847,
11886,
473,
7,
16,
340,
310,
659,
72471... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_box_str() {
use std::string::String;
let s = String::from("foo").into_boxed_str();
let r: Arc<str> = Arc::from(s);
assert_eq!(&r[..], "foo");
} | rust_cleaned_test_functions.jsonl/42729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
10194,
2895,
368,
341,
262,
990,
1460,
486,
917,
486,
703,
401,
262,
1077,
274,
284,
923,
486,
1499,
445,
7975,
1827,
18122,
10194,
291,
2895,
543,
262,
1077,
435,
25,
19689,
27,
495,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_memory_size_primitive_nullable() {
let arr: PrimitiveArray<Int64Type> = (0..128).map(Some).collect();
let empty_with_bitmap = PrimitiveArray::<Int64Type>::from(
ArrayData::builder(arr.data_type().clone())
.add_buffer(MutableBuffer::new(0).into())
.null_bit_buffer(MutableBuffer::new_null(0).into())
.build()
.unwrap(),
);
// which includes the optional validity buffer
// plus one buffer on the heap
assert_eq!(
std::mem::size_of::<PrimitiveArray<Int64Type>>()
+ std::mem::size_of::<Buffer>(),
empty_with_bitmap.get_array_memory_size()
);
// substract empty array to avoid magic numbers for the size of additional fields
// the size of the validity bitmap is rounded up to 64 bytes
assert_eq!(
arr.get_array_memory_size() - empty_with_bitmap.get_array_memory_size(),
128 * std::mem::size_of::<i64>() + 64
);
} | rust_cleaned_test_functions.jsonl/7997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 509
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19195,
2368,
84087,
69743,
368,
341,
286,
1077,
2890,
25,
51460,
1857,
34520,
21,
19,
929,
29,
284,
320,
15,
496,
16,
17,
23,
568,
2186,
65405,
568,
17384,
543,
286,
1077,
4287,
6615,
41527,
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_impl_with_other_type_param() {
check_assist(
introduce_named_lifetime,
"impl<I> fmt::Display for SepByBuilder<'_<|>, I>
where
I: Iterator,
I::Item: fmt::Display,
{",
"impl<I, 'a> fmt::Display for SepByBuilder<'a, I>
where
I: Iterator,
I::Item: fmt::Display,
{",
)
} | rust_cleaned_test_functions.jsonl/109550 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21007,
6615,
30456,
1819,
4090,
368,
341,
286,
1779,
12083,
380,
1006,
310,
19131,
71834,
98827,
345,
310,
330,
6383,
13332,
29,
8879,
486,
7020,
369,
17449,
1359,
3297,
18291,
41743,
91,
8066,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pause() {
test_harness(|| unsafe {
library_init();
let session = get_session();
let mut gid = A2Gid::default();
assert_eq!(
add_uri(
session,
&mut gid,
&vec!["http://localhost/1".into()],
&vec![],
-1,
),
0
);
{
let handle = get_download_handle(session, gid);
assert!(!handle.is_null());
assert_eq!(handle.status(), DownloadStatus::DOWNLOAD_WAITING);
}
assert_eq!(pause_download(session, 0, false), -1);
assert_eq!(pause_download(session, gid, false), 0);
{
let handle = get_download_handle(session, gid);
assert!(!handle.is_null());
assert_eq!(handle.status(), DownloadStatus::DOWNLOAD_PAUSED);
}
assert_eq!(unpause_download(session, 0), -1);
assert_eq!(unpause_download(session, gid), 0);
{
let handle = get_download_handle(session, gid);
assert!(!handle.is_null());
assert_eq!(handle.status(), DownloadStatus::DOWNLOAD_WAITING);
}
assert_eq!(remove_download(session, 0, false), -1);
assert_eq!(remove_download(session, gid, false), 0);
{
let handle = get_download_handle(session, gid);
assert!(handle.is_null());
}
session_final(session);
library_deinit();
});
} | rust_cleaned_test_functions.jsonl/25964 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 794
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
59989,
368,
341,
262,
1273,
1523,
23518,
79453,
19860,
341,
286,
6733,
6137,
543,
286,
1077,
3797,
284,
633,
12316,
1428,
286,
1077,
5206,
45863,
284,
362,
17,
38,
307,
486,
2258,
543,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rev_words() {
let tests = [("", ""),
("a", "a"),
("a b", "b a"),
("cat dog", "dog cat"),
// compressed into a single space.
("cat dog", "dog cat"),
("cat dog frog", "frog dog cat")];
for &(input, expected) in tests.iter() {
let output = rev_words(input);
assert!(expected.equiv(&output));
}
} | rust_cleaned_test_functions.jsonl/15902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38082,
18981,
368,
341,
262,
1077,
7032,
284,
508,
19814,
72712,
338,
3489,
64,
497,
330,
64,
4461,
338,
3489,
64,
293,
497,
330,
65,
264,
4461,
338,
3489,
4616,
5562,
497,
330,
18457,
8251,
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... | 2 |
#[test]
fn test_wpa3_sme_auth_config() {
let bss = fake_bss!(Wpa3);
let mut device_info = fake_device_info([0xaa; 6]);
device_info.driver_features = vec![fidl_fuchsia_wlan_common::DriverFeature::SaeSmeAuth];
let auth_config = get_wpa3_auth_config(&device_info, vec![0xbb; 8], &bss)
.expect("Failed to create auth config");
assert_variant!(auth_config,
auth::Config::Sae { password, .. } => assert_eq!(password, vec![0xbb; 8]));
} | rust_cleaned_test_functions.jsonl/6074 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
6595,
18,
643,
2660,
14014,
5332,
368,
341,
286,
1077,
293,
778,
284,
12418,
880,
778,
10297,
54,
6595,
18,
317,
286,
1077,
5206,
3671,
3109,
284,
12418,
9204,
3109,
2561,
15,
43300,
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_find_roots_one_in_one_out() {
let quad = BoundedQuadratic::new(2.5, 5., 1., -5., 6.);
let extended = quad.extend_domain();
let (quad_x1, quad_x2) = quad.find_roots();
let (ext_x1, ext_x2) = extended.find_roots();
assert_eq!(quad_x1, 3.);
assert!(!quad_x2.is_finite());
assert_eq!(ext_x1, 2.);
assert_eq!(ext_x2, 3.);
} | rust_cleaned_test_functions.jsonl/19870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
26608,
2412,
11667,
1243,
11667,
6068,
368,
341,
286,
1077,
27082,
284,
425,
13082,
2183,
88678,
486,
931,
7,
17,
13,
20,
11,
220,
20,
2572,
220,
16,
2572,
481,
20,
2572,
220,
21,
58957... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_u64() {
let data = [
0x6b, 0x32, 0x01, 0x00, 0x9c, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
assert_eq!(
parse(&data).unwrap().token_tape,
vec![BinaryToken::Token(0x326b), BinaryToken::U64(128),]
);
} | rust_cleaned_test_functions.jsonl/109424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
21,
19,
368,
341,
286,
1077,
821,
284,
2278,
310,
220,
15,
87,
21,
65,
11,
220,
15,
87,
18,
17,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
24,
66,
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_negation_non_zero_modulus() {
let zero: ModInt = ModInt {
value: BigInt::zero(),
modulus: BigInt::from(11),
};
// 0 mod 11 = 0
let neg_zero: ModInt = zero.neg();
assert_eq!(BigInt::from(0), neg_zero.value);
assert_eq!(BigInt::from(11), neg_zero.modulus);
let one: ModInt = ModInt {
value: BigInt::from(23),
modulus: BigInt::from(11),
};
// 23 mod 11 = 1
let neg_one: ModInt = one.neg();
assert_eq!(BigInt::from(10), neg_one.value);
assert_eq!(BigInt::from(11), neg_one.modulus);
let two: ModInt = ModInt {
value: BigInt::from(2),
modulus: BigInt::from(11),
};
// 2 mod 11 = 2
let neg_two = two.neg();
assert_eq!(BigInt::from(9), neg_two.value);
assert_eq!(BigInt::from(11), neg_two.modulus);
} | rust_cleaned_test_functions.jsonl/126145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
367,
21637,
19359,
7480,
19425,
368,
341,
286,
1077,
7168,
25,
5650,
1072,
284,
5650,
1072,
341,
310,
897,
25,
62608,
486,
14154,
3148,
310,
74024,
25,
62608,
486,
1499,
7,
16,
16,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_marginal_trailer() {
let mut log = new_record_test();
// make a trailer that is exactly the same length as an empty record
let n = BLOCK_SIZE - 2 * HEADER_SIZE;
log.write(big_string("foo", n).as_str());
assert_eq!(BLOCK_SIZE - HEADER_SIZE, log.written_bytes());
log.write("");
log.write("bar");
assert_eq!(big_string("foo", n).as_str(), log.read());
assert_eq!("", log.read());
assert_eq!("bar", log.read());
assert_eq!(EOF, log.read());
} | rust_cleaned_test_functions.jsonl/46682 | {
"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,
717,
858,
977,
3547,
38782,
368,
341,
286,
1077,
5206,
1487,
284,
501,
14192,
4452,
543,
286,
442,
1281,
264,
19253,
429,
374,
6896,
279,
1852,
3084,
438,
458,
4287,
3255,
198,
286,
1077,
308,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_downcast_ref() {
assert_eq!(
"oh no!",
*bail_literal().unwrap_err().downcast_ref::<&str>().unwrap(),
);
assert_eq!(
"oh no!",
bail_fmt().unwrap_err().downcast_ref::<String>().unwrap(),
);
assert_eq!(
"oh no!",
bail_error()
.unwrap_err()
.downcast_ref::<io::Error>()
.unwrap()
.to_string(),
);
} | rust_cleaned_test_functions.jsonl/69156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13998,
3829,
7793,
368,
341,
262,
2060,
10714,
33673,
286,
330,
2267,
902,
33436,
286,
353,
65,
604,
34100,
1005,
15454,
9266,
1005,
2923,
3829,
7793,
27638,
5,
495,
10483,
15454,
3148,
262,
1439,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_os_rng_huge() {
let mut r = OsRng::new().unwrap();
let mut huge = [0u8; 100_000];
r.fill_bytes(&mut huge);
} | rust_cleaned_test_functions.jsonl/76530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29387,
66849,
1523,
4733,
368,
341,
262,
1077,
5206,
435,
284,
15433,
49,
968,
486,
931,
1005,
15454,
1428,
262,
1077,
5206,
6765,
284,
508,
15,
84,
23,
26,
220,
16,
15,
15,
62,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ptr_map_cell_none() {
let type_id = TypeId::of::<u32>();
let pm:PtrMapCell<u32> = PtrMapCell::new();
assert_eq!(pm.get(type_id),None);
} | rust_cleaned_test_functions.jsonl/88911 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4348,
5376,
16648,
31488,
368,
341,
286,
1077,
943,
842,
284,
3990,
764,
486,
1055,
27638,
84,
18,
17,
3913,
286,
1077,
8836,
25,
5348,
2227,
3599,
34837,
18,
17,
29,
284,
46409,
2227,
3599,
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 |
#[test]
fn test_introduce_var_for_break_not_applicable() {
check_assist_range_not_applicable(
introduce_variable,
"fn main() { loop { <|>break<|>; }; }",
);
} | rust_cleaned_test_functions.jsonl/5723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
47845,
4612,
5478,
39494,
7913,
8191,
46114,
368,
341,
286,
1779,
12083,
380,
9698,
7913,
8191,
46114,
1006,
310,
19131,
14635,
345,
310,
330,
8822,
1887,
368,
314,
6337,
314,
82639,
29,
896... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_update_config() {
let (cfg, _dir) = TiKvConfig::with_tmp().unwrap();
let mut cfg_controller = ConfigController::new(cfg);
let mut cfg = cfg_controller.get_current().clone();
// normal update
cfg_controller
.update(change("raftstore.raft-log-gc-threshold", "2000"))
.unwrap();
cfg.raft_store.raft_log_gc_threshold = 2000;
assert_eq!(cfg_controller.get_current(), &cfg);
// update not support config
let res = cfg_controller.update(change("server.addr", "localhost:3000"));
assert!(res.is_err());
assert_eq!(cfg_controller.get_current(), &cfg);
// update to invalid config
let res = cfg_controller.update(change("raftstore.raft-log-gc-threshold", "0"));
assert!(res.is_err());
assert_eq!(cfg_controller.get_current(), &cfg);
// bad update request
let res = cfg_controller.update(change("xxx.yyy", "0"));
assert!(res.is_err());
let res = cfg_controller.update(change("raftstore.xxx", "0"));
assert!(res.is_err());
let res = cfg_controller.update(change("raftstore.raft-log-gc-threshold", "10MB"));
assert!(res.is_err());
let res = cfg_controller.update(change("raft-log-gc-threshold", "10MB"));
assert!(res.is_err());
assert_eq!(cfg_controller.get_current(), &cfg);
} | rust_cleaned_test_functions.jsonl/63650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
5332,
368,
341,
262,
1077,
320,
14072,
11,
716,
3741,
8,
284,
22325,
42,
85,
2648,
486,
4197,
16125,
1005,
15454,
543,
262,
1077,
5206,
13286,
21600,
284,
5532,
2051,
486,
931,
28272,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binary_examples() {
assert_eq!(eval("1+3"), Ok(Value::Int(4)));
assert_eq!(eval("3+1"), Ok(Value::Int(4)));
assert_eq!(eval("3-5"), Ok(Value::Int(-2)));
assert_eq!(eval("5-3"), Ok(Value::Int(2)));
assert_eq!(eval("5 / 4"), Ok(Value::Int(1)));
assert_eq!(eval("5 *3"), Ok(Value::Int(15)));
assert_eq!(eval("1.0+3"), Ok(Value::Float(4.0)));
assert_eq!(eval("3.0+1"), Ok(Value::Float(4.0)));
assert_eq!(eval("3-5.0"), Ok(Value::Float(-2.0)));
assert_eq!(eval("5-3.0"), Ok(Value::Float(2.0)));
assert_eq!(eval("5 / 4.0"), Ok(Value::Float(1.25)));
assert_eq!(eval("5.0 *3"), Ok(Value::Float(15.0)));
assert_eq!(eval("5.0 *-3"), Ok(Value::Float(-15.0)));
assert_eq!(eval("5.0 *- 3"), Ok(Value::Float(-15.0)));
assert_eq!(eval("5.0 * -3"), Ok(Value::Float(-15.0)));
assert_eq!(eval("5.0 * - 3"), Ok(Value::Float(-15.0)));
assert_eq!(eval("-5.0 *-3"), Ok(Value::Float(15.0)));
assert_eq!(eval("3+-1"), Ok(Value::Int(2)));
assert_eq!(eval("-3-5"), Ok(Value::Int(-8)));
assert_eq!(eval("-5--3"), Ok(Value::Int(-2)));
} | rust_cleaned_test_functions.jsonl/105338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 555
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
45279,
368,
341,
262,
2060,
10714,
10297,
14170,
445,
16,
10,
18,
3975,
7622,
25346,
486,
1072,
7,
19,
4945,
262,
2060,
10714,
10297,
14170,
445,
18,
10,
16,
3975,
7622,
25346,
486,
1072,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fill_peer_window() {
let mut s = socket_established();
s.remote_mss = 6;
s.send_slice(b"abcdef123456!@#$%^").unwrap();
recv!(s, [TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"abcdef"[..],
..RECV_TEMPL
}, TcpRepr {
seq_number: LOCAL_SEQ + 1 + 6,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"123456"[..],
..RECV_TEMPL
}, TcpRepr {
seq_number: LOCAL_SEQ + 1 + 6 + 6,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"!@#$%^"[..],
..RECV_TEMPL
}]);
} | rust_cleaned_test_functions.jsonl/1775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 439
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
45159,
12571,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
274,
34093,
717,
778,
284,
220,
21,
280,
286,
274,
5219,
26488,
1883,
1,
41202,
16,
17,
18,
19,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error_message(){
let msg = error_message(&1);
assert_eq!(msg, "Unknown Error");
let msg = error_message(&1002);
assert_eq!(msg, "Error with Connection");
} | rust_cleaned_test_functions.jsonl/19289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
6462,
3032,
286,
1077,
3750,
284,
1465,
6462,
2099,
16,
317,
286,
2060,
10714,
10297,
3236,
11,
330,
13790,
4600,
3071,
286,
1077,
3750,
284,
1465,
6462,
2099,
16,
15,
15,
17,
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 |
#[test]
fn test_normalize_path_merge_slashes() {
let app = App::new()
.resource("/resource1", |r| r.method(Method::GET).f(index))
.resource("/resource1/a/b", |r| r.method(Method::GET).f(index))
.default_resource(|r| r.h(NormalizePath::default()))
.finish();
// trailing slashes
let params = vec![
("/resource1/a/b", "", StatusCode::OK),
("/resource1/", "/resource1", StatusCode::MOVED_PERMANENTLY),
("/resource1//", "/resource1", StatusCode::MOVED_PERMANENTLY),
(
"//resource1//a//b",
"/resource1/a/b",
StatusCode::MOVED_PERMANENTLY,
),
(
"//resource1//a//b/",
"/resource1/a/b",
StatusCode::MOVED_PERMANENTLY,
),
(
"//resource1//a//b//",
"/resource1/a/b",
StatusCode::MOVED_PERMANENTLY,
),
(
"///resource1//a//b",
"/resource1/a/b",
StatusCode::MOVED_PERMANENTLY,
),
(
"/////resource1/a///b",
"/resource1/a/b",
StatusCode::MOVED_PERMANENTLY,
),
(
"/////resource1/a//b/",
"/resource1/a/b",
StatusCode::MOVED_PERMANENTLY,
),
("/resource1/a/b?p=1", "", StatusCode::OK),
(
"//resource1//a//b?p=1",
"/resource1/a/b?p=1",
StatusCode::MOVED_PERMANENTLY,
),
(
"//resource1//a//b/?p=1",
"/resource1/a/b?p=1",
StatusCode::MOVED_PERMANENTLY,
),
(
"///resource1//a//b?p=1",
"/resource1/a/b?p=1",
StatusCode::MOVED_PERMANENTLY,
),
(
"/////resource1/a///b?p=1",
"/resource1/a/b?p=1",
StatusCode::MOVED_PERMANENTLY,
),
(
"/////resource1/a//b/?p=1",
"/resource1/a/b?p=1",
StatusCode::MOVED_PERMANENTLY,
),
(
"/////resource1/a//b//?p=1",
"/resource1/a/b?p=1",
StatusCode::MOVED_PERMANENTLY,
),
];
for (path, target, code) in params {
let req = TestRequest::with_uri(path).request();
let resp = app.run(req);
let r = &resp.as_msg();
assert_eq!(r.status(), code);
if !target.is_empty() {
assert_eq!(
target,
r.headers().get(header::LOCATION).unwrap().to_str().unwrap()
);
}
}
} | rust_cleaned_test_functions.jsonl/38138 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1876
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80807,
2638,
20888,
11886,
14051,
368,
341,
286,
1077,
906,
284,
1845,
486,
931,
741,
310,
659,
9233,
4283,
9233,
16,
497,
760,
81,
91,
435,
12908,
35419,
486,
3806,
568,
69,
7195,
1171,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_from_space_track_omm() -> Result<()> {
let elements: Elements = serde_json::from_str(
r#"{"CCSDS_OMM_VERS":"2.0",
"COMMENT":"GENERATED VIA SPACE-TRACK.ORG API",
"CREATION_DATE":"2020-12-13T17:26:09",
"ORIGINATOR":"18 SPCS",
"OBJECT_NAME":"ISS (ZARYA)",
"OBJECT_ID":"1998-067A",
"CENTER_NAME":"EARTH",
"REF_FRAME":"TEME",
"TIME_SYSTEM":"UTC",
"MEAN_ELEMENT_THEORY":"SGP4",
"EPOCH":"2020-12-13T16:36:04.502592",
"MEAN_MOTION":"15.49181153",
"ECCENTRICITY":"0.00017790",
"INCLINATION":"51.6444",
"RA_OF_ASC_NODE":"180.2777",
"ARG_OF_PERICENTER":"128.5985",
"MEAN_ANOMALY":"350.1361",
"EPHEMERIS_TYPE":"0",
"CLASSIFICATION_TYPE":"U",
"NORAD_CAT_ID":"25544",
"ELEMENT_SET_NO":"999",
"REV_AT_EPOCH":"25984",
"BSTAR":"0.00002412400000",
"MEAN_MOTION_DOT":"0.00000888",
"MEAN_MOTION_DDOT":"0.0000000000000",
"SEMIMAJOR_AXIS":"6797.257",
"PERIOD":"92.952",
"APOAPSIS":"420.331",
"PERIAPSIS":"417.912",
"OBJECT_TYPE":"PAYLOAD",
"RCS_SIZE":"LARGE",
"COUNTRY_CODE":"ISS",
"LAUNCH_DATE":"1998-11-20",
"SITE":"TTMTR",
"DECAY_DATE":null,
"FILE":"2902442",
"GP_ID":"167697146",
"TLE_LINE0":"0 ISS (ZARYA)",
"TLE_LINE1":"1 25544U 98067A 20348.69171878 .00000888 00000-0 24124-4 0 9995",
"TLE_LINE2":"2 25544 51.6444 180.2777 0001779 128.5985 350.1361 15.49181153259845"
}"#,
)?;
match elements.object_name.as_ref() {
Some(object_name) => assert_eq!(object_name, "ISS (ZARYA)"),
None => panic!(),
}
assert_eq!(elements.norad_id, 25544);
assert!(matches!(
elements.classification,
Classification::Unclassified
));
assert_eq!(
elements.international_designator.as_ref().unwrap(),
"1998-067A"
);
assert_eq!(
elements.datetime,
chrono::NaiveDate::from_yo(2020, 348).and_time(
chrono::NaiveTime::from_num_seconds_from_midnight(59764, 502592000)
)
);
assert_eq_f64(elements.epoch(), 20.95055912054757);
assert_eq_f64(elements.epoch_afspc_compatibility_mode(), 20.95055912054749);
assert_eq_f64(elements.mean_motion_dot, 0.00000888);
assert_eq_f64(elements.mean_motion_ddot, 0.0);
assert_eq_f64(elements.drag_term, 0.000024124);
assert_eq!(elements.ephemeris_type, 0);
assert_eq!(elements.element_set_number, 999);
assert_eq_f64(elements.inclination, 51.6444);
assert_eq_f64(elements.right_ascension, 180.2777);
assert_eq_f64(elements.eccentricity, 0.0001779);
assert_eq_f64(elements.argument_of_perigee, 128.5985);
assert_eq_f64(elements.mean_anomaly, 350.1361);
assert_eq_f64(elements.mean_motion, 15.49181153);
assert_eq!(elements.revolution_number, 25984);
Ok(())
} | rust_cleaned_test_functions.jsonl/74831 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2037
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
14663,
28545,
62,
19786,
368,
1464,
5714,
71698,
341,
286,
1077,
5424,
25,
34157,
284,
61570,
9455,
486,
1499,
2895,
1006,
310,
435,
55543,
4913,
3706,
5491,
50,
83169,
44,
2334,
4321,
3252,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_missing_file() {
cmd()
.arg("noexist")
.assert()
.failure()
.stderr(predicate::str::starts_with(
r#"error: opening noexist: No such file or directory"#,
));
} | rust_cleaned_test_functions.jsonl/120311 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
2458,
368,
341,
262,
5439,
741,
286,
659,
858,
445,
2152,
28575,
1138,
286,
659,
2207,
741,
286,
659,
28939,
741,
286,
659,
36422,
76172,
486,
495,
486,
65876,
6615,
1006,
310,
435,
55543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_iter() {
let tmpdir = starcoin_config::temp_dir();
let storage = Storage::new(StorageInstance::new_cache_and_db_instance(
CacheStorage::new(None),
DBStorage::new(tmpdir.path(), RocksdbConfig::default(), None).unwrap(),
))
.unwrap();
let transaction_info1 = RichTransactionInfo::new(
HashValue::random(),
rand::random(),
TransactionInfo::new(
HashValue::random(),
HashValue::zero(),
vec![].as_slice(),
0,
KeptVMStatus::Executed,
),
rand::random(),
rand::random(),
);
let id = transaction_info1.id();
storage
.transaction_info_storage
.put(id, transaction_info1.clone())
.unwrap();
let mut iter = storage.transaction_info_storage.iter().unwrap();
iter.seek_to_first();
let transaction_info2 = iter.next().and_then(|item| item.ok());
assert!(transaction_info2.is_some());
assert_eq!(transaction_info1, transaction_info2.unwrap().1);
assert!(iter.next().is_none());
} | rust_cleaned_test_functions.jsonl/73685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
368,
341,
262,
1077,
4174,
3741,
284,
6774,
7160,
5332,
486,
3888,
4334,
543,
262,
1077,
5819,
284,
14693,
486,
931,
7,
5793,
2523,
486,
931,
11529,
8378,
8685,
11904,
1006,
286,
19479,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_specifier_enabled() {
let config = setup();
let specifier = resolve_url("file:///a.ts").unwrap();
assert!(!config.specifier_enabled(&specifier));
config
.set_workspace_settings(json!({
"enable": true
}))
.expect("could not update");
assert!(config.specifier_enabled(&specifier));
} | rust_cleaned_test_functions.jsonl/20063 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
13594,
3049,
18220,
368,
341,
262,
1077,
2193,
284,
6505,
543,
262,
1077,
97616,
284,
8830,
2903,
445,
1192,
60896,
64,
21288,
1827,
15454,
543,
262,
2060,
0,
3471,
1676,
28326,
3049,
18220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bits() {
let mut fb = FooBar(0);
assert_eq!(0, fb.all_bits());
fb.set_all_bits(!0u32);
assert_eq!(!0u32, fb.0);
assert_eq!(!0u32, fb.all_bits());
fb.0 = 0x8000_0001;
assert_eq!(0x8000_0001, fb.all_bits());
} | rust_cleaned_test_functions.jsonl/2273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
20034,
368,
341,
262,
1077,
5206,
25469,
284,
33428,
3428,
7,
15,
626,
262,
2060,
10714,
10297,
15,
11,
25469,
7670,
20034,
5231,
262,
25469,
980,
5705,
20034,
3471,
15,
84,
18,
17,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_str_indices_trigger_debug_assertions() {
fn none_ors() -> impl Iterator<Item = NoneOr<i32>> {
iter::once(NoneOr::None).chain((-30..30).map(NoneOr::Other))
}
for s in &["", "a", "abcde", "Телемак"] {
for start in none_ors() {
for end in none_ors() {
let _ = convert_str_indices(s, start, end);
}
}
}
} | rust_cleaned_test_functions.jsonl/101242 | {
"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,
34910,
2895,
18333,
32925,
15446,
16553,
908,
368,
341,
286,
5168,
6857,
62,
1087,
368,
1464,
11605,
23023,
31857,
284,
2240,
2195,
21897,
18,
17,
2452,
341,
310,
5367,
486,
13184,
26717,
2195,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_task_one() {
assert_eq!(4, first_task_job("#1 @ 1,3: 4x4\n#2 @ 3,1: 4x4\n#3 @ 5,5: 2x2".as_bytes()))
} | rust_cleaned_test_functions.jsonl/35264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12184,
11667,
368,
341,
286,
2060,
10714,
10297,
19,
11,
1156,
12184,
20298,
3584,
16,
569,
220,
16,
11,
18,
25,
220,
19,
87,
19,
1699,
2,
17,
569,
220,
18,
11,
16,
25,
220,
19,
87,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_date() {
let settings = WorkerSettings::<()>::new(Vec::new(), KeepAlive::Os);
let mut buf1 = BytesMut::with_capacity(DATE_VALUE_LENGTH + 10);
settings.set_date(&mut buf1);
let mut buf2 = BytesMut::with_capacity(DATE_VALUE_LENGTH + 10);
settings.set_date(&mut buf2);
assert_eq!(buf1, buf2);
} | rust_cleaned_test_functions.jsonl/1838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
368,
341,
286,
1077,
5003,
284,
33086,
6086,
27638,
368,
6831,
931,
49923,
486,
931,
1507,
13655,
32637,
486,
28867,
317,
286,
1077,
5206,
6607,
16,
284,
30024,
51440,
486,
4197,
35603,
5432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shorter() {
let m1 = mount_info("/dev/foo", "/", "/mnt/bar");
let m2 = mount_info("/dev/foo", "/", "/mnt/bar/baz");
assert!(!mount_info_lt(&m1, &m2));
let m1 = mount_info("/dev/foo", "/root", "/mnt/bar");
let m2 = mount_info("/dev/foo", "/", "/mnt/bar/baz");
assert!(mount_info_lt(&m1, &m2));
} | rust_cleaned_test_functions.jsonl/7060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
261,
368,
341,
3374,
310,
1077,
296,
16,
284,
6470,
3109,
4283,
3583,
60555,
497,
64657,
3521,
40882,
49513,
797,
310,
1077,
296,
17,
284,
6470,
3109,
4283,
3583,
60555,
497,
64657,
3521,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_utf8string() {
assert_eq!(
ber_read_content_utf8string("AZaz09 '()+,-./:=?[]{}\0\nüÜ".as_ref(), 28),
Ok((
[].as_ref(),
BerObjectContent::UTF8String("AZaz09 '()+,-./:=?[]{}\0\nüÜ")
)),
);
assert_eq!(
ber_read_content_utf8string(b"", 0),
Ok(([].as_ref(), BerObjectContent::UTF8String(""))),
);
assert!(ber_read_content_utf8string(b"\xe2\x28\xa1", 3).is_err());
} | rust_cleaned_test_functions.jsonl/55464 | {
"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,
39453,
23,
917,
368,
341,
262,
2060,
10714,
33673,
286,
10207,
6443,
7495,
39453,
23,
917,
445,
23563,
1370,
15,
24,
364,
17140,
4999,
1725,
14209,
30,
1294,
87963,
15,
1699,
2391,
52491,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_output_simple() {
new_ucmd!()
.args(&["alpha.txt"])
.succeeds()
.stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n");
} | rust_cleaned_test_functions.jsonl/90923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
30015,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
7141,
3909,
14108,
286,
659,
82,
29264,
82,
741,
286,
659,
36358,
18410,
445,
13683,
450,
1699,
69,
866,
3172,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_long_lists() {
assert!(check_identity(concat![
"(the-header-is-always-inline\n",
" (first-child with more arguments)\n",
" (next (child (is (nested))))\n",
" (this\n",
" (is nested more)\n",
" (and more)\n",
" (x x x x x x x x)\n",
" (x x x x x x x x)\n",
" (x x x x x x x x)\n",
" (x x x x x x x x))\n",
" and\n",
" this\n",
" is\n",
" the-end)"]));
} | rust_cleaned_test_functions.jsonl/21589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
37288,
368,
341,
262,
2060,
10297,
2028,
46244,
96360,
90515,
286,
11993,
1782,
9351,
30430,
18779,
2284,
23633,
1699,
756,
286,
330,
220,
320,
3896,
23484,
448,
803,
5977,
10699,
77,
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_empty_dir() {
let tempdir = tempfile::tempdir().unwrap();
let request = Request {
path: tempdir.path().to_path_buf(),
};
let mut session = session::test::Fake::new();
assert!(handle(&mut session, request).is_ok());
assert_eq!(session.reply_count(), 0);
} | rust_cleaned_test_functions.jsonl/69102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
4334,
368,
341,
286,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
1428,
286,
1077,
1681,
284,
6145,
341,
310,
1815,
25,
2730,
3741,
3875,
1005,
983,
2638,
10363,
3148,
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_machine_for_test() {
let writer = Writer::new_test(Some(Format::Json));
writer.machine(&"hello").unwrap();
assert_eq!(writer.test_output().unwrap(), "\"hello\"");
} | rust_cleaned_test_functions.jsonl/125540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38695,
5478,
4452,
368,
341,
286,
1077,
6916,
284,
29404,
486,
931,
4452,
65405,
7,
4061,
486,
5014,
1106,
286,
6916,
77726,
2099,
1,
14990,
1827,
15454,
1428,
286,
2060,
10714,
10297,
18189,
5958... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_hash_id() {
let mut repo = Persistent::try_new(None).expect("failed to create context");
let mut output = Vec::with_capacity(10);
let mut stats = Default::default();
let number = HashId::new(10101).unwrap();
serialize_hash_id(number, &mut output, &mut repo, &mut stats).unwrap();
let (hash_id, size) = deserialize_hash_id(&output).unwrap();
assert_eq!(output.len(), 4);
assert_eq!(hash_id.unwrap(), number);
assert_eq!(size, 4);
output.clear();
let number = HashId::new((u32::MAX as u64) + 10).unwrap();
serialize_hash_id(number, &mut output, &mut repo, &mut stats).unwrap();
let (hash_id, size) = deserialize_hash_id(&output).unwrap();
assert_eq!(output.len(), 6);
assert_eq!(hash_id.unwrap(), number);
assert_eq!(size, 6);
output.clear();
let number = HashId::new(u32::MAX as u64).unwrap();
serialize_hash_id(number, &mut output, &mut repo, &mut stats).unwrap();
let (hash_id, size) = deserialize_hash_id(&output).unwrap();
assert_eq!(output.len(), 6);
assert_eq!(hash_id.unwrap(), number);
assert_eq!(size, 6);
} | rust_cleaned_test_functions.jsonl/80242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 552
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
842,
368,
341,
286,
1077,
5206,
15867,
284,
66544,
486,
1539,
5921,
26717,
568,
17119,
445,
16091,
311,
1855,
2266,
797,
286,
1077,
5206,
2550,
284,
11312,
486,
4197,
35603,
7,
16,
15,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid() {
let (path, _directory) = support::deploy("invalid");
unsafe {
let mut stkd: StackDescription_t = mem::uninitialized();
let mut analysis: Analysis_t = mem::uninitialized();
let mut output: Output_t = mem::uninitialized();
stack_description_init(&mut stkd);
analysis_init(&mut analysis);
output_init(&mut output);
let result = parse_stack_description_file(path_to_cstr!(path).as_ptr() as *mut _,
&mut stkd, &mut analysis, &mut output);
assert!(result != TDICE_SUCCESS);
stack_description_destroy(&mut stkd);
analysis_destroy(&mut analysis);
output_destroy(&mut output);
}
} | rust_cleaned_test_functions.jsonl/8135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
368,
341,
262,
1077,
320,
2343,
11,
716,
23037,
8,
284,
1824,
486,
35794,
445,
11808,
3071,
262,
19860,
341,
286,
1077,
5206,
357,
37744,
25,
14284,
5009,
528,
284,
1833,
486,
359,
36161,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_utf8() {
let logger = slog::Logger::root(slog::Discard, slog::o!());
let string_subsystem = Subsystem::new(64, &logger);
let xs = b"hello";
assert_eq!(
Name::from_utf8(xs, &string_subsystem).unwrap(),
Name::new("hello", &string_subsystem)
);
let xs = "ศไทย中华Việt Nam".as_bytes();
assert_eq!(
Name::from_utf8(xs, &string_subsystem).unwrap(),
Name::new("ศไทย中华Việt Nam", &string_subsystem)
);
} | rust_cleaned_test_functions.jsonl/109232 | {
"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,
5673,
39453,
23,
368,
341,
197,
10217,
5925,
284,
34949,
486,
7395,
486,
2888,
1141,
839,
486,
23477,
567,
11,
34949,
486,
78,
0,
1423,
197,
10217,
914,
5228,
8948,
284,
3719,
8948,
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_shard_with_string() {
let mut config = Config::default();
config.shard = Some("core".to_string());
let result = util::shard(config);
assert_eq!(result, 30);
} | rust_cleaned_test_functions.jsonl/118179 | {
"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,
3712,
567,
6615,
3904,
368,
341,
286,
1077,
5206,
2193,
284,
5532,
486,
2258,
543,
286,
2193,
2395,
567,
284,
4329,
445,
2153,
3263,
983,
3904,
1423,
286,
1077,
1102,
284,
4094,
486,
927,
567,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_args_iter_no_conflict() {
static ARGS: [ArgInfo<ArgData>; 2] = [flag!("-foo", FooFlag), flag!("-fooz", FooFlag)];
ArgsIter::new(Vec::<OsString>::new().into_iter(), &ARGS[..]);
} | rust_cleaned_test_functions.jsonl/16242 | {
"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,
8384,
11723,
6536,
16059,
21242,
368,
341,
310,
1099,
84149,
25,
508,
2735,
1731,
27,
2735,
1043,
65795,
220,
17,
60,
284,
508,
9903,
0,
13645,
7975,
497,
33428,
12135,
701,
5181,
0,
13645,
7975... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bad_root_hash() {
let bad_digest = Digest([0u8; 32]);
let (cid, pk, payload) = make_certified_delta(
vec![make_change(vec![upsert("key", "value")])],
1..=1,
GarbleResponse::OverrideCertifiedData(bad_digest.clone()),
);
match decode_certified_deltas(0, &cid, &pk, &payload[..]) {
Err(CertificationError::CertifiedDataMismatch { certified, .. })
if &certified[..] == bad_digest.as_bytes() => {}
other => panic!(
"Expected CertifiedDataMismatch error containing the bad digest {}, got {:?}",
bad_digest, other
),
}
} | rust_cleaned_test_functions.jsonl/122441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
34199,
12993,
8950,
368,
341,
262,
1077,
3873,
52994,
284,
53289,
2561,
15,
84,
23,
26,
220,
18,
17,
10149,
262,
1077,
320,
20558,
11,
22458,
11,
7729,
8,
284,
1281,
37097,
1870,
26710,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pykmip_query_response() {
let response_hex = concat!(
"42007b010000014042007a0100000048420069010000002042006a0200000004000000010000000042006b02000000040",
"00000000000000042009209000000080000000060ff457142000d0200000004000000010000000042000f01000000e842",
"005c0500000004000000180000000042007f0500000004000000000000000042007c01000000c042005c0500000004000",
"000010000000042005c0500000004000000020000000042005c0500000004000000030000000042005c05000000040000",
"00050000000042005c0500000004000000080000000042005c05000000040000000a0000000042005c050000000400000",
"00b0000000042005c05000000040000000c0000000042005c0500000004000000120000000042005c0500000004000000",
"130000000042005c0500000004000000140000000042005c05000000040000001800000000"
);
let response_bytes = hex::decode(response_hex).unwrap();
let mut stream = MockStream {
response: Cursor::new(response_bytes),
};
let client = ClientBuilder::new(&mut stream).build();
let result = client
.do_request(RequestPayload::Query(vec![QueryFunction::QueryOperations]))
.unwrap();
if let ResponsePayload::Query(payload) = result {
dbg!(payload);
} else {
panic!("Expected query response!");
}
} | rust_cleaned_test_functions.jsonl/26633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 579
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40291,
16017,
573,
5738,
9655,
368,
341,
286,
1077,
2033,
32655,
284,
33720,
33673,
310,
330,
19,
17,
15,
15,
22,
65,
15,
16,
15,
15,
15,
15,
15,
16,
19,
15,
19,
17,
15,
15,
22,
64,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_eval_ternary_function() {
#[rpn_fn(nullable)]
fn foo(v1: Option<&i64>, v2: Option<&i64>, v3: Option<&i64>) -> Result<Option<i64>> {
Ok(Some(v1.unwrap() - v2.unwrap() * v3.unwrap()))
}
let mut columns = LazyBatchColumnVec::from(vec![{
let mut col = LazyBatchColumn::decoded_with_capacity_and_tp(3, EvalType::Int);
col.mut_decoded().push_int(Some(1));
col.mut_decoded().push_int(Some(5));
col.mut_decoded().push_int(Some(-4));
col
}]);
let schema = &[FieldTypeTp::LongLong.into()];
let exp = RpnExpressionBuilder::new_for_test()
.push_column_ref_for_test(0)
.push_constant_for_test(3i64)
.push_column_ref_for_test(0)
.push_fn_call_for_test(foo_fn_meta(), 3, FieldTypeTp::LongLong)
.build_for_test();
let mut ctx = EvalContext::default();
let result = exp.eval(&mut ctx, schema, &mut columns, &[1, 0, 2], 3);
let val = result.unwrap();
assert!(val.is_vector());
assert_eq!(
val.vector_value().unwrap().as_ref().to_int_vec(),
[Some(-10), Some(-2), Some(8)]
);
assert_eq!(val.vector_value().unwrap().logical_rows(), &[0, 1, 2]);
assert_eq!(val.field_type().as_accessor().tp(), FieldTypeTp::LongLong);
} | rust_cleaned_test_functions.jsonl/92670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 730
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
62,
4160,
658,
9174,
368,
341,
394,
11506,
81,
19958,
15246,
34885,
5563,
286,
5168,
15229,
3747,
16,
25,
6959,
52244,
72,
21,
19,
8066,
348,
17,
25,
6959,
52244,
72,
21,
19,
8066,
348,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hdfs() {
let dfs = get_dfs();
{
let minidfs_addr = dfs.namenode_addr();
let fs = dfs.get_hdfs().ok().unwrap();
// Test hadoop file
{
let uuid = Uuid::new_v4().to_string();
let test_file = uuid.as_str();
let created_file = match fs.create(test_file) {
Ok(f) => f,
Err(_) => panic!("Couldn't create a file"),
};
assert!(created_file.close().is_ok());
assert!(fs.exist(test_file));
// open a file and close
let opened_file = fs.open(test_file).ok().unwrap();
assert!(opened_file.close().is_ok());
// Clean up
assert!(fs.delete(test_file, false).is_ok());
}
// Test directory
{
let uuid = Uuid::new_v4().to_string();
let test_dir = format!("/{}", uuid);
match fs.mkdir(&test_dir) {
Ok(_) => println!("{} created", test_dir),
Err(_) => panic!("Couldn't create {} directory", test_dir),
};
let file_info = fs.get_file_status(&test_dir).ok().unwrap();
let expected_path = format!("{}{}", minidfs_addr, test_dir);
assert_eq!(&expected_path, file_info.name());
assert!(!file_info.is_file());
assert!(file_info.is_directory());
let sub_dir_num = 3;
let mut expected_list = Vec::new();
for x in 0..sub_dir_num {
let filename = format!("{}/{}", test_dir, x);
expected_list.push(format!("{}{}/{}", minidfs_addr, test_dir, x));
match fs.mkdir(&filename) {
Ok(_) => println!("{} created", filename),
Err(_) => panic!("Couldn't create {} directory", filename),
};
}
let mut list = fs.list_status(&test_dir).ok().unwrap();
assert_eq!(sub_dir_num, list.len());
list.sort_by(|a, b| Ord::cmp(a.name(), b.name()));
for (expected, name) in expected_list
.iter()
.zip(list.iter().map(|status| status.name()))
{
assert_eq!(expected, name);
}
// Clean up
assert!(fs.delete(&test_dir, true).is_ok());
}
}
} | rust_cleaned_test_functions.jsonl/29890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1536
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
34378,
368,
341,
286,
1077,
25792,
284,
633,
814,
3848,
543,
286,
341,
310,
1077,
1308,
307,
3848,
7387,
284,
25792,
1253,
24774,
534,
7387,
543,
310,
1077,
8619,
284,
25792,
670,
1523,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_output_stream_write_raw_little_endian64() {
test_write("f1 e2 d3 c4 b5 a6 07 f8", |os| {
os.write_raw_little_endian64(0xf807a6b5c4d3e2f1)
});
} | rust_cleaned_test_functions.jsonl/104521 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
12673,
9165,
16067,
907,
2377,
87193,
21,
19,
368,
341,
286,
1273,
9165,
445,
69,
16,
384,
17,
294,
18,
272,
19,
293,
20,
264,
21,
220,
15,
22,
282,
23,
497,
760,
436,
91,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_example_2_1() {
let input = "qzmt-zixmtkozy-ivhz-343[dummy]";
let answer: usize = solve(&input, 2);
assert_eq!(answer, 0);
} | rust_cleaned_test_functions.jsonl/49459 | {
"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,
39304,
62,
17,
62,
16,
368,
341,
286,
1077,
1946,
284,
330,
80,
89,
2501,
9141,
941,
2501,
9325,
4246,
12,
344,
37259,
12,
18,
19,
18,
21427,
8574,
59757,
286,
1077,
4226,
25,
22301,
284,
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 |
#[test]
fn test_filter_issue1(){
assert_eq!(filter(&b"age=lt.20&product=eq.134&price=lt.100.0"[..]), IResult::Done(&b""[..],
Filter{
connector: None,
condition: Condition{
left: Operand::Column("age".to_string()),
equality: Equality::LT,
right: Operand::Number(20f64)
},
sub_filters:vec![
Filter{
condition:Condition{
left: Operand::Column("product".to_string()),
equality: Equality::EQ,
right: Operand::Number(134f64)
},
connector: Some(Connector::AND),
sub_filters: vec![
]
},
Filter{
connector: Some(Connector::AND),
condition: Condition{
left: Operand::Column("price".to_string()),
equality: Equality::LT,
right: Operand::Number(100.0)
},
sub_filters: vec![]
}
]
}
));
} | rust_cleaned_test_functions.jsonl/114306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 768
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
53340,
16,
3032,
262,
2060,
10714,
10297,
5315,
2099,
65,
1,
424,
28,
4832,
13,
17,
15,
5,
3031,
28,
11006,
13,
16,
18,
19,
5,
6555,
28,
4832,
13,
16,
15,
15,
13,
15,
36864,
496,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_rest_api() {
let bank_forks = create_bank_forks();
assert_eq!(None, process_rest(&bank_forks, "not-a-supported-rest-api"));
assert_eq!(
process_rest(&bank_forks, "/v0/circulating-supply"),
process_rest(&bank_forks, "/v0/total-supply")
);
} | rust_cleaned_test_functions.jsonl/6867 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
32231,
11697,
368,
341,
286,
1077,
6073,
761,
73302,
284,
1855,
35733,
761,
73302,
1428,
286,
2060,
10714,
10297,
4064,
11,
1882,
32231,
2099,
17033,
761,
73302,
11,
330,
1921,
7409,
87113,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shell_version() {
let tested = ShellCompatibilityVersion::new("TEST_CHAIN".to_string(), vec![3, 4], vec![1, 2]);
assert!(matches!(tested.choose_compatible_version(&NetworkVersion::new("TEST_XYZ".to_string(), 0, 0)), Err(NackMotive::UnknownChainName)));
assert!(matches!(tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 0, 0)), Err(NackMotive::DeprecatedDistributedDbVersion)));
assert!(matches!(tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 1, 0)), Err(NackMotive::DeprecatedDistributedDbVersion)));
assert!(matches!(tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 2, 0)), Err(NackMotive::DeprecatedDistributedDbVersion)));
assert!(matches!(tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 3, 0)), Err(NackMotive::DeprecatedP2pVersion)));
assert!(matches!(tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 4, 0)), Err(NackMotive::DeprecatedP2pVersion)));
assert!(matches!(tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 5, 0)), Err(NackMotive::DeprecatedP2pVersion)));
assert_eq!(
tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 3, 1)),
Ok(NetworkVersion::new("TEST_CHAIN".to_string(), 3, 1))
);
assert_eq!(
tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 3, 2)),
Ok(NetworkVersion::new("TEST_CHAIN".to_string(), 3, 2))
);
assert_eq!(
tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 3, 3)),
Ok(NetworkVersion::new("TEST_CHAIN".to_string(), 3, 2))
);
assert_eq!(
tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 4, 1)),
Ok(NetworkVersion::new("TEST_CHAIN".to_string(), 4, 1))
);
assert_eq!(
tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 4, 2)),
Ok(NetworkVersion::new("TEST_CHAIN".to_string(), 4, 2))
);
assert_eq!(
tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 4, 3)),
Ok(NetworkVersion::new("TEST_CHAIN".to_string(), 4, 2))
);
assert_eq!(
tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 5, 1)),
Ok(NetworkVersion::new("TEST_CHAIN".to_string(), 4, 1))
);
assert_eq!(
tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 5, 2)),
Ok(NetworkVersion::new("TEST_CHAIN".to_string(), 4, 2))
);
assert_eq!(
tested.choose_compatible_version(&NetworkVersion::new("TEST_CHAIN".to_string(), 5, 3)),
Ok(NetworkVersion::new("TEST_CHAIN".to_string(), 4, 2))
);
assert_eq!(tested.to_network_version(), NetworkVersion::new("TEST_CHAIN".to_string(), 4, 2));
} | rust_cleaned_test_functions.jsonl/511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48945,
9438,
368,
341,
286,
1077,
12510,
284,
29402,
85880,
5637,
486,
931,
445,
10033,
70232,
3263,
983,
3904,
1507,
7486,
20703,
18,
11,
220,
19,
1125,
7486,
20703,
16,
11,
220,
17,
10149,
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_node_merge_with_slow_learner() {
let mut cluster = new_node_cluster(0, 2);
configure_for_merge(&mut cluster);
cluster.cfg.raft_store.raft_log_gc_threshold = 40;
cluster.cfg.raft_store.raft_log_gc_count_limit = 40;
cluster.cfg.raft_store.merge_max_log_gap = 15;
cluster.pd_client.disable_default_operator();
// Create a cluster with peer 1 as leader and peer 2 as learner.
let r1 = cluster.run_conf_change();
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.must_add_peer(r1, new_learner_peer(2, 2));
// Split the region.
let pd_client = Arc::clone(&cluster.pd_client);
let region = pd_client.get_region(b"k1").unwrap();
cluster.must_split(®ion, b"k2");
let left = pd_client.get_region(b"k1").unwrap();
let right = pd_client.get_region(b"k2").unwrap();
assert_eq!(region.get_id(), right.get_id());
assert_eq!(left.get_end_key(), right.get_start_key());
assert_eq!(right.get_start_key(), b"k2");
// Make sure the leader has received the learner's last index.
cluster.must_put(b"k1", b"v1");
cluster.must_put(b"k3", b"v3");
must_get_equal(&cluster.get_engine(2), b"k1", b"v1");
must_get_equal(&cluster.get_engine(2), b"k3", b"v3");
cluster.add_send_filter(IsolationFilterFactory::new(2));
(0..20).for_each(|i| cluster.must_put(b"k1", format!("v{}", i).as_bytes()));
// Merge 2 regions under isolation should fail.
let merge = new_prepare_merge(right.clone());
let req = new_admin_request(left.get_id(), left.get_region_epoch(), merge);
let resp = cluster
.call_command_on_leader(req, Duration::from_secs(3))
.unwrap();
assert!(resp
.get_header()
.get_error()
.get_message()
.contains("log gap"));
cluster.clear_send_filters();
cluster.must_put(b"k11", b"v100");
must_get_equal(&cluster.get_engine(1), b"k11", b"v100");
must_get_equal(&cluster.get_engine(2), b"k11", b"v100");
pd_client.must_merge(left.get_id(), right.get_id());
// Test slow learner will be cleaned up when merge can't be continued.
let region = pd_client.get_region(b"k1").unwrap();
cluster.must_split(®ion, b"k5");
cluster.must_put(b"k4", b"v4");
cluster.must_put(b"k5", b"v5");
must_get_equal(&cluster.get_engine(2), b"k4", b"v4");
must_get_equal(&cluster.get_engine(2), b"k5", b"v5");
let left = pd_client.get_region(b"k1").unwrap();
let right = pd_client.get_region(b"k5").unwrap();
cluster.add_send_filter(IsolationFilterFactory::new(2));
pd_client.must_merge(left.get_id(), right.get_id());
let state1 = cluster.truncated_state(right.get_id(), 1);
(0..50).for_each(|i| cluster.must_put(b"k2", format!("v{}", i).as_bytes()));
// Wait to trigger compact raft log
let timer = Instant::now();
loop {
let state2 = cluster.truncated_state(right.get_id(), 1);
if state1.get_index() != state2.get_index() {
break;
}
if timer.elapsed() > Duration::from_secs(3) {
panic!("log compaction not finish after 3 seconds.");
}
sleep_ms(10);
}
cluster.clear_send_filters();
cluster.must_put(b"k6", b"v6");
must_get_equal(&cluster.get_engine(2), b"k6", b"v6");
} | rust_cleaned_test_functions.jsonl/95185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1452
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
20888,
6615,
82447,
62,
93595,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
17,
317,
262,
14411,
5478,
20888,
2099,
6984,
10652,
317,
262,
10652,
30481,
13,
294... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hsv2hsl() {
let hsv_vec = vec!["hsv(180,100%,50%)", "hsv(400,100%,50%)"];
let test_result = vec![
vec!["hsl(180.00,100%,25%)", "HSL(180.00,100%,25%)", "hsl(180.00,100%,25%)", "hsla(180.00,100%,25%,1)", "HSL(180.00,100%,25%)", "HSLA(180.00,100%,25%,1)", "hsla(180.00,100%,25%,1)", "HSLA(180.00,100%,25%,1)", ],
vec!["hsl(40.00,100%,25%)", "HSL(40.00,100%,25%)", "hsl(40.00,100%,25%)", "hsla(40.00,100%,25%,1)", "HSL(40.00,100%,25%)", "HSLA(40.00,100%,25%,1)", "hsla(40.00,100%,25%,1)", "HSLA(40.00,100%,25%,1)", ],
];
let test_color = init_color(hsv_vec);
for (i, vec_color) in test_color.iter().enumerate() {
for (index, color) in vec_color.iter().enumerate() {
assert_eq!(test_result[i][index], color.to_hsl().unwrap());
}
}
} | rust_cleaned_test_functions.jsonl/35856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
3492,
17,
71,
3226,
368,
341,
197,
10217,
82333,
13251,
284,
7486,
0,
1183,
71,
3492,
7,
16,
23,
15,
11,
16,
15,
15,
13384,
20,
15,
11334,
497,
330,
71,
3492,
7,
19,
15,
15,
11,
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... | 3 |
#[test]
fn test_named_wildcard_collide() {
let mut tree = PathTree::<usize>::new();
tree.insert("/git/:org/:repo", 1);
tree.insert("/git/*any", 2);
let node = tree.find("/git/rust-lang/rust");
assert!(node.is_some());
let res = node.unwrap();
assert_eq!(*res.0, 1);
assert_eq!(res.1, [("org", "rust-lang"), ("repo", "rust")]);
let node = tree.find("/git/rust-lang");
assert!(node.is_some());
let res = node.unwrap();
assert_eq!(*res.0, 2);
assert_eq!(res.1, [("any", "rust-lang")]);
} | rust_cleaned_test_functions.jsonl/12990 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71834,
1670,
695,
4951,
43597,
577,
368,
341,
262,
1077,
5206,
4916,
284,
7933,
6533,
27638,
51878,
6831,
931,
543,
262,
4916,
7030,
4283,
12882,
11315,
1775,
11315,
23476,
497,
220,
16,
317,
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_pair_count_hashmap_count() {
let inputs = read_lines("data/day_14_sample.txt");
let (template, rules) = parse_inputs(&inputs);
let rules_map = rules_as_map(&rules);
let (pair_counts, start) = even_faster_expand_iter(&template, &rules_map, 40);
let (min, max) = min_max_from_pairs(&pair_counts, start);
assert_eq!(max - min, 2188189693529);
} | rust_cleaned_test_functions.jsonl/105370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14445,
3180,
8950,
2186,
3180,
368,
341,
262,
1077,
11127,
284,
1349,
18323,
445,
691,
44739,
62,
16,
19,
17491,
3909,
797,
262,
1077,
320,
4214,
11,
5601,
8,
284,
4715,
28557,
2099,
24941,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_addr_key() {
assert_eq!(
addr_key(&net::IpAddr::V4(net::Ipv4Addr::new(255, 0, 3, 4))),
0
);
assert_eq!(
addr_key(&net::IpAddr::V4(net::Ipv4Addr::new(255, 1, 3, 4))),
1
);
assert_eq!(
addr_key(&net::IpAddr::V4(net::Ipv4Addr::new(1, 255, 3, 4))),
1
);
} | rust_cleaned_test_functions.jsonl/79211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7387,
3097,
368,
341,
286,
2060,
10714,
33673,
310,
10789,
3097,
2099,
4711,
486,
23378,
13986,
486,
53,
19,
30723,
486,
80656,
19,
13986,
486,
931,
7,
17,
20,
20,
11,
220,
15,
11,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pause_split_when_snap_gen_will_split() {
let is_generating_snapshot = "is_generating_snapshot";
fail::cfg(is_generating_snapshot, "return()").unwrap();
let (region, left, right) = gen_split_region();
assert_ne!(left, right);
assert_eq!(region.get_start_key(), left.get_start_key());
assert_eq!(right.get_start_key(), left.get_end_key());
assert_eq!(region.get_end_key(), right.get_end_key());
fail::remove(is_generating_snapshot);
} | rust_cleaned_test_functions.jsonl/45464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59989,
17052,
47636,
74175,
16322,
1670,
483,
17052,
368,
341,
262,
1077,
374,
71963,
1095,
53265,
284,
330,
285,
71963,
1095,
53265,
876,
262,
3690,
486,
14072,
9623,
71963,
1095,
53265,
11,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nonexistent_file() {
new_ucmd!()
.arg("nonexistent.txt")
.fails()
.status_code(2)
.stderr_only(
#[cfg(not(windows))]
"sort: cannot read: nonexistent.txt: No such file or directory",
#[cfg(windows)]
"sort: cannot read: nonexistent.txt: The system cannot find the file specified.",
);
} | rust_cleaned_test_functions.jsonl/20531 | {
"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,
21637,
64085,
2458,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
445,
6280,
64085,
3909,
1138,
286,
659,
59631,
741,
286,
659,
2829,
4136,
7,
17,
340,
286,
659,
36422,
18410,
1006,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.