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_identity_scalar() {
fn prop_transform(val: f64) -> bool { (Identity.transform(val) - val).abs() < 1e-7 }
fn prop_grad(val: f64) -> bool { (Identity.grad(val) - 1.0).abs() < 1e-7 }
quickcheck(prop_transform as fn(f64) -> bool);
quickcheck(prop_grad as fn(f64) -> bool);
} | rust_cleaned_test_functions.jsonl/78483 | {
"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,
46244,
41652,
368,
341,
286,
5168,
2004,
18449,
9098,
25,
282,
21,
19,
8,
1464,
1807,
314,
320,
18558,
8134,
9098,
8,
481,
1044,
568,
3435,
368,
366,
220,
16,
68,
12,
22,
555,
286,
5168,
200... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_math() {
assert_eq!(Bloom::<Hash>::num_bits(100f64, 0.1f64) as u64, 480u64);
assert_eq!(Bloom::<Hash>::num_bits(100f64, 0.01f64) as u64, 959u64);
assert_eq!(Bloom::<Hash>::num_keys(1000f64, 50f64) as u64, 14u64);
assert_eq!(Bloom::<Hash>::num_keys(2000f64, 50f64) as u64, 28u64);
assert_eq!(Bloom::<Hash>::num_keys(2000f64, 25f64) as u64, 55u64);
//ensure min keys is 1
assert_eq!(Bloom::<Hash>::num_keys(20f64, 1000f64) as u64, 1u64);
} | rust_cleaned_test_functions.jsonl/34503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
65561,
368,
341,
286,
2060,
10714,
10297,
33,
18474,
27638,
6370,
6831,
2413,
20034,
7,
16,
15,
15,
69,
21,
19,
11,
220,
15,
13,
16,
69,
21,
19,
8,
438,
575,
21,
19,
11,
220,
19,
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_blake2s_precomp_constraints() {
// doesn't result in more constraints.
let mut cs = TestConstraintSystem::<Fr>::new();
let rng = &mut test_rng();
let input_bits: Vec<_> = (0..512)
.map(|_| Boolean::constant(rng.next_u32() % 2 != 0))
.chain((0..512).map(|i| {
AllocatedBit::alloc(cs.ns(|| format!("input bit {}", i)), Some(true))
.unwrap()
.into()
}))
.collect();
blake2s(&mut cs, &input_bits, b"12345678").unwrap();
assert!(cs.is_satisfied());
assert_eq!(cs.num_constraints(), 21518);
} | rust_cleaned_test_functions.jsonl/102742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13141,
726,
17,
82,
10442,
5689,
60267,
368,
341,
1789,
286,
442,
3171,
944,
1102,
304,
803,
16982,
382,
286,
1077,
5206,
10532,
284,
3393,
17890,
2320,
27638,
22560,
6831,
931,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add_books_from_warehouse() -> Result<()> {
let query = SqlBuilder::select_from("warehouse")
.field("title")
.field("preliminary_price * 2")
.query()?;
assert_eq!("SELECT title, preliminary_price * 2 FROM warehouse", &query);
let sql = SqlBuilder::insert_into("books")
.field("title")
.field("price")
.select(&query)
.sql()?;
assert_eq!(
"INSERT INTO books (title, price) SELECT title, preliminary_price * 2 FROM warehouse;",
&sql
);
Ok(())
} | rust_cleaned_test_functions.jsonl/12604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
73084,
5673,
62,
45546,
368,
1464,
5714,
71698,
341,
286,
1077,
3239,
284,
7224,
3297,
486,
1742,
5673,
445,
45546,
1138,
310,
659,
2566,
445,
2102,
1138,
310,
659,
2566,
445,
1726,
4659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_accounts_empty_hash_internal_state() {
let paths = get_tmp_accounts_path!();
let accounts = AccountsDB::new(0, &paths.paths);
assert_eq!(accounts.hash_internal_state(0), None);
} | rust_cleaned_test_functions.jsonl/77673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
15124,
8950,
23472,
4387,
368,
341,
286,
1077,
12716,
284,
633,
16125,
55665,
2638,
0,
543,
286,
1077,
9618,
284,
40655,
3506,
486,
931,
7,
15,
11,
609,
21623,
65345,
317,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_indexed_f64() {
let mut schema_builder = Schema::builder();
let value_field = schema_builder.add_f64_field("value", INDEXED);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
let mut index_writer = index.writer_with_num_threads(1, 3_000_000).unwrap();
let val = std::f64::consts::PI;
index_writer.add_document(doc!(value_field => val));
index_writer.commit().unwrap();
let reader = index.reader().unwrap();
let searcher = reader.searcher();
let term = Term::from_field_f64(value_field, val);
let mut postings = searcher
.segment_reader(0)
.inverted_index(term.field())
.read_postings(&term, IndexRecordOption::Basic)
.unwrap();
assert!(postings.advance());
assert_eq!(postings.doc(), 0);
assert!(!postings.advance());
} | rust_cleaned_test_functions.jsonl/41948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 428
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
291,
761,
21,
19,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
897,
5013,
284,
10802,
28532,
1364,
761,
21,
19,
5013,
445,
957,
497,
39300,
1479,
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_ls_order_time() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch("test-1");
at.append("test-1", "1");
sleep(Duration::from_millis(100));
at.touch("test-2");
at.append("test-2", "22");
sleep(Duration::from_millis(100));
at.touch("test-3");
at.append("test-3", "333");
sleep(Duration::from_millis(100));
at.touch("test-4");
at.append("test-4", "4444");
sleep(Duration::from_millis(100));
at.read("test-3");
std::fs::set_permissions(
at.plus_as_string("test-2"),
at.metadata("test-2").permissions(),
)
.unwrap();
scene.ucmd().arg("-al").succeeds();
let result = scene.ucmd().arg("-t").succeeds();
#[cfg(not(windows))]
result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n");
#[cfg(windows)]
result.stdout_only("test-4 test-3 test-2 test-1\n");
let result = scene.ucmd().arg("--sort=time").succeeds();
#[cfg(not(windows))]
result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n");
#[cfg(windows)]
result.stdout_only("test-4 test-3 test-2 test-1\n");
let result = scene.ucmd().arg("-tr").succeeds();
#[cfg(not(windows))]
result.stdout_only("test-1\ntest-2\ntest-3\ntest-4\n");
#[cfg(windows)]
result.stdout_only("test-1 test-2 test-3 test-4\n");
let result = scene.ucmd().arg("--sort=time").arg("-r").succeeds();
#[cfg(not(windows))]
result.stdout_only("test-1\ntest-2\ntest-3\ntest-4\n");
#[cfg(windows)]
result.stdout_only("test-1 test-2 test-3 test-4\n");
// 3 was accessed last in the read
// So the order should be 2 3 4 1
for arg in &["-u", "--time=atime", "--time=access", "--time=use"] {
let result = scene.ucmd().arg("-t").arg(arg).succeeds();
let file3_access = at.open("test-3").metadata().unwrap().accessed().unwrap();
let file4_access = at.open("test-4").metadata().unwrap().accessed().unwrap();
// It seems to be dependent on the platform whether the access time is actually set
if file3_access > file4_access {
if cfg!(not(windows)) {
result.stdout_only("test-3\ntest-4\ntest-2\ntest-1\n");
} else {
result.stdout_only("test-3 test-4 test-2 test-1\n");
}
} else {
// Access time does not seem to be set on Windows and some other
// systems so the order is 4 3 2 1
if cfg!(not(windows)) {
result.stdout_only("test-4\ntest-3\ntest-2\ntest-1\n");
} else {
result.stdout_only("test-4 test-3 test-2 test-1\n");
}
}
}
// test-2 had the last ctime change when the permissions were set
// So the order should be 2 4 3 1
#[cfg(unix)]
{
let result = scene.ucmd().arg("-tc").succeeds();
result.stdout_only("test-2\ntest-4\ntest-3\ntest-1\n");
}
} | rust_cleaned_test_functions.jsonl/71207 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53174,
7869,
3009,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,
401,
262,
518,
42129,
445,
1944,
12,
16,
797,
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... | 5 |
#[test]
fn test_verify_and_hash_transaction_sig_len() {
let GenesisConfigInfo {
mut genesis_config, ..
} = create_genesis_config_with_leader(42, &solana_sdk::pubkey::new_rand(), 42);
// activate all features but verify_tx_signatures_len
activate_all_features(&mut genesis_config);
genesis_config
.accounts
.remove(&feature_set::verify_tx_signatures_len::id());
let bank = Bank::new_for_tests(&genesis_config);
let mut rng = rand::thread_rng();
let recent_blockhash = hash::new_rand(&mut rng);
let from_keypair = Keypair::new();
let to_keypair = Keypair::new();
let from_pubkey = from_keypair.pubkey();
let to_pubkey = to_keypair.pubkey();
enum TestCase {
AddSignature,
RemoveSignature,
}
let make_transaction = |case: TestCase| {
let message = Message::new(
&[system_instruction::transfer(&from_pubkey, &to_pubkey, 1)],
Some(&from_pubkey),
);
let mut tx = Transaction::new(&[&from_keypair], message, recent_blockhash);
assert_eq!(tx.message.header.num_required_signatures, 1);
match case {
TestCase::AddSignature => {
let signature = to_keypair.sign_message(&tx.message.serialize());
tx.signatures.push(signature);
}
TestCase::RemoveSignature => {
tx.signatures.remove(0);
}
}
tx
};
// Too few signatures: Sanitization failure
{
let tx = make_transaction(TestCase::RemoveSignature);
assert_eq!(
bank.verify_transaction(tx.into(), TransactionVerificationMode::FullVerification)
.err(),
Some(TransactionError::SanitizeFailure),
);
}
// Too many signatures: Sanitization failure
{
let tx = make_transaction(TestCase::AddSignature);
assert_eq!(
bank.verify_transaction(tx.into(), TransactionVerificationMode::FullVerification)
.err(),
Some(TransactionError::SanitizeFailure),
);
}
} | rust_cleaned_test_functions.jsonl/29000 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
8378,
8950,
28884,
29252,
6043,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
5206,
59366,
5332,
11,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
6615,
79991,
7,
19,
17,
11,
609,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_decode_b() {
// BEQ.N
match decode_16(0xd001) {
Instruction::B_t13 { params, thumb32 } => {
assert_eq!(params.cond, Condition::EQ);
assert_eq!(params.imm32, (1 << 1));
assert_eq!(thumb32, false);
}
_ => {
println!(" {}", decode_16(0xd001));
assert!(false);
}
}
// BNE.N
match decode_16(0xd1f8) {
Instruction::B_t13 { params, thumb32 } => {
assert!(params.cond == Condition::NE);
assert!(params.imm32 == -16);
assert_eq!(thumb32, false);
}
_ => {
assert!(false);
}
}
match decode_16(0xE004) {
Instruction::B_t24 { imm32, thumb32 } => {
assert!(imm32 == (4 << 1));
assert_eq!(thumb32, false);
}
_ => {
assert!(false);
}
}
} | rust_cleaned_test_functions.jsonl/64742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 526
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
880,
368,
341,
262,
442,
7206,
48,
2067,
198,
262,
2432,
16895,
62,
16,
21,
7,
15,
9703,
15,
15,
16,
8,
341,
286,
29051,
486,
33,
528,
16,
18,
314,
3628,
11,
24050,
18,
17,
335,
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... | 4 |
#[test]
fn test_transform() {
let wait_time = Duration::from_millis(50);
let _ = actix_rt::System::new("test").block_on(lazy(|| {
let mut srv =
Blank::new().and_then(InFlightService::new(1, SleepService(wait_time)));
assert_eq!(srv.poll_ready(), Ok(Async::Ready(())));
let mut res = srv.call(());
let _ = res.poll();
assert_eq!(srv.poll_ready(), Ok(Async::NotReady));
drop(res);
assert_eq!(srv.poll_ready(), Ok(Async::Ready(())));
Ok::<_, ()>(())
}));
} | rust_cleaned_test_functions.jsonl/17815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18449,
368,
341,
286,
1077,
3783,
3009,
284,
21045,
486,
1499,
717,
56212,
7,
20,
15,
317,
286,
1077,
716,
284,
1160,
941,
40169,
486,
2320,
486,
931,
445,
1944,
1827,
4574,
4470,
2333,
13619,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uniform_from_std_range_inclusive() {
let r = Uniform::from(2u32..=6);
assert_eq!(r.0.low, 2);
assert_eq!(r.0.range, 5);
let r = Uniform::from(2.0f64..=7.0);
assert_eq!(r.0.low, 2.0);
assert!(r.0.scale > 5.0);
assert!(r.0.scale < 5.0 + 1e-14);
} | rust_cleaned_test_functions.jsonl/42159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45066,
5673,
15656,
9698,
1243,
8336,
368,
341,
286,
1077,
435,
284,
47889,
486,
1499,
7,
17,
84,
18,
17,
496,
28,
21,
317,
286,
2060,
10714,
10297,
81,
13,
15,
56553,
11,
220,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_claim_full() {
let total_initial_reward = INITIAL_PAYMENT * DEFAULT_NB_OF_CONTRIBUTORS * DEFAULT_REWARD;
let total_vested_reward = DEFAULT_NB_OF_CONTRIBUTORS * DEFAULT_REWARD - total_initial_reward;
let nb_of_vesting_step = DEFAULT_VESTING_PERIOD / VESTING_STEP;
with_rewards_default(|set_moment, accounts| {
assert_ok!(CrowdloanRewards::initialize(Origin::root()));
// Initial payment
for (picasso_account, remote_account) in accounts.clone().into_iter() {
assert_ok!(remote_account.associate(picasso_account));
}
assert_eq!(CrowdloanRewards::claimed_rewards(), total_initial_reward);
for i in 1..(nb_of_vesting_step + 1) {
set_moment(i * VESTING_STEP);
for (picasso_account, remote_account) in accounts.clone().into_iter() {
assert_ok!(remote_account.claim(picasso_account));
}
assert_eq!(
CrowdloanRewards::claimed_rewards(),
total_initial_reward + total_vested_reward * i as u128 / nb_of_vesting_step as u128,
);
}
for (picasso_account, remote_account) in accounts.into_iter() {
assert_noop!(remote_account.claim(picasso_account), Error::<Test>::NothingToClaim);
}
assert_eq!(CrowdloanRewards::claimed_rewards(), CrowdloanRewards::total_rewards());
});
} | rust_cleaned_test_functions.jsonl/41096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
84969,
16372,
368,
341,
10217,
2790,
15809,
38260,
284,
56854,
67566,
353,
11955,
80107,
14234,
4307,
2378,
15954,
9821,
353,
11955,
2192,
28166,
280,
10217,
2790,
2273,
9980,
38260,
284,
11955,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bmp() {
assert_eq_ok!(
ImageInfo::from_file_path("images/valid/bmp/sample.bmp"),
ImageInfo {
format: ImageFormat::BMP,
ext: "bmp",
full_ext: "bmp",
mimetype: "image/bmp",
size: ImageSize { width: 123, height: 456 },
entry_sizes: vec![],
}
);
assert_eq_ok!(
ImageInfo::from_file_path("images/valid/bmp/sample2.bmp"),
ImageInfo {
format: ImageFormat::BMP,
ext: "bmp",
full_ext: "bmp",
mimetype: "image/bmp",
size: ImageSize { width: 123, height: 456 },
entry_sizes: vec![],
}
);
} | rust_cleaned_test_functions.jsonl/65155 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
1307,
368,
341,
262,
2060,
10714,
19817,
33673,
286,
4654,
1731,
486,
1499,
2458,
2638,
445,
3642,
14,
1891,
3470,
1307,
69851,
55476,
4461,
286,
4654,
1731,
341,
310,
3561,
25,
4654,
4061,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_headers_from_hyp() {
assert_headers!("friends" => ["alice"]);
assert_headers!("friends" => ["alice", "bob"]);
assert_headers!("friends" => ["alice", "bob, carol"]);
assert_headers!("friends" => ["alice, david", "bob, carol", "eric, frank"]);
assert_headers!("friends" => ["alice"], "enemies" => ["victor"]);
assert_headers!("friends" => ["alice", "bob"], "enemies" => ["david", "emily"]);
} | rust_cleaned_test_functions.jsonl/94550 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
26719,
5673,
1523,
1082,
368,
341,
262,
2060,
26719,
17223,
29462,
1,
589,
4383,
63195,
15049,
262,
2060,
26719,
17223,
29462,
1,
589,
4383,
63195,
497,
330,
47086,
15049,
262,
2060,
26719,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_node_config_addresses() {
let mut ctx = Context::default();
let external = "127.0.0.1:1234";
ctx.set_arg(PEER_ADDRESS, external.to_string());
assert_eq!(
GenerateNodeConfig::addresses(&ctx),
(external.to_string(), "0.0.0.0:1234".parse().unwrap())
);
let external = "127.0.0.1";
ctx.set_arg(PEER_ADDRESS, external.to_string());
assert_eq!(
GenerateNodeConfig::addresses(&ctx),
(
SocketAddr::new(external.parse().unwrap(), DEFAULT_EXONUM_LISTEN_PORT).to_string(),
SocketAddr::new("0.0.0.0".parse().unwrap(), DEFAULT_EXONUM_LISTEN_PORT)
)
);
let external = "2001:db8::1";
ctx.set_arg(PEER_ADDRESS, external.to_string());
assert_eq!(
GenerateNodeConfig::addresses(&ctx),
(
SocketAddr::new(external.parse().unwrap(), DEFAULT_EXONUM_LISTEN_PORT).to_string(),
SocketAddr::new("::".parse().unwrap(), DEFAULT_EXONUM_LISTEN_PORT)
)
);
let external = "[2001:db8::1]:1234";
ctx.set_arg(PEER_ADDRESS, external.to_string());
assert_eq!(
GenerateNodeConfig::addresses(&ctx),
(external.to_string(), "[::]:1234".parse().unwrap())
);
let external = "localhost";
ctx.set_arg(PEER_ADDRESS, external.to_string());
assert_eq!(
GenerateNodeConfig::addresses(&ctx),
(
format!("{}:{}", external, DEFAULT_EXONUM_LISTEN_PORT),
SocketAddr::new("0.0.0.0".parse().unwrap(), DEFAULT_EXONUM_LISTEN_PORT)
)
);
let external = "localhost:1234";
ctx.set_arg(PEER_ADDRESS, external.to_string());
assert_eq!(
GenerateNodeConfig::addresses(&ctx),
(
external.to_string(),
SocketAddr::new("0.0.0.0".parse().unwrap(), 1234)
)
);
let external = "127.0.0.1:1234";
let listen = "1.2.3.4:5678";
ctx.set_arg(PEER_ADDRESS, external.to_string());
ctx.set_arg(LISTEN_ADDRESS, listen.to_string());
assert_eq!(
GenerateNodeConfig::addresses(&ctx),
(external.to_string(), listen.parse().unwrap())
);
let external = "127.0.0.1:1234";
let listen = "1.2.3.4:5678";
ctx.set_arg(PEER_ADDRESS, external.to_string());
ctx.set_arg(LISTEN_ADDRESS, listen.to_string());
assert_eq!(
GenerateNodeConfig::addresses(&ctx),
(external.to_string(), listen.parse().unwrap())
);
let external = "example.com";
let listen = "[2001:db8::1]:5678";
ctx.set_arg(PEER_ADDRESS, external.to_string());
ctx.set_arg(LISTEN_ADDRESS, listen.to_string());
assert_eq!(
GenerateNodeConfig::addresses(&ctx),
(
format!("{}:{}", external, DEFAULT_EXONUM_LISTEN_PORT),
listen.parse().unwrap()
)
);
} | rust_cleaned_test_functions.jsonl/115964 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
5084,
5332,
59471,
368,
341,
286,
1077,
5206,
5635,
284,
9608,
486,
2258,
1428,
286,
1077,
9250,
284,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
16,
17,
18,
19,
876,
286,
5635,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_1nnn() {
let mut test = setup_opcode(0x1333);
test.tick();
assert_eq!(test.pc, 0x333);
} | rust_cleaned_test_functions.jsonl/69464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
7370,
77,
368,
341,
286,
1077,
5206,
1273,
284,
6505,
71319,
7,
15,
87,
16,
18,
18,
18,
317,
286,
1273,
40323,
2129,
715,
286,
2060,
10714,
10297,
1944,
53335,
11,
220,
15,
87,
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 |
#[test]
fn test_tap_suite_builder() {
let tests = vec![TapTestBuilder::new()
.name("Example TAP test")
.passed(true)
.finalize()];
let tap_suite_from_builder = TapSuiteBuilder::new()
.name("Example TAP test suite")
.tests(tests)
.finalize();
let tap_suite_from_scratch = TapSuite {
name: "Example TAP test suite".to_string(),
tests: vec![TapTestBuilder::new()
.name("Example TAP test")
.passed(true)
.finalize()],
};
assert_eq!(tap_suite_from_builder, tap_suite_from_scratch);
} | rust_cleaned_test_functions.jsonl/100642 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
391,
57239,
28532,
368,
341,
286,
1077,
7032,
284,
7486,
20703,
23879,
2271,
3297,
486,
931,
741,
310,
659,
606,
445,
13314,
350,
2537,
1273,
1138,
310,
659,
35422,
3715,
340,
310,
659,
944... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_const_local_shadowing() {
compare_stderr_output(
r#"
package main
const x0 bool = false
const x1 int8 = 45
const x2 int16 = 66
const x3 uint = 4
func main() {
const x0 bool = true
println(x0)
println(x1)
const x1 int8 = 54
println(x1)
println(x2)
const x2 uint = 800 + x3
println(x2)
x3 := -9
println(x3)
}
"#,
"true\n45\n54\n66\n804\n-9\n",
)
} | rust_cleaned_test_functions.jsonl/20932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13610,
13564,
53120,
287,
368,
341,
262,
9429,
93033,
7645,
1006,
286,
435,
2,
698,
1722,
1887,
271,
1024,
856,
15,
1807,
284,
895,
198,
1024,
856,
16,
526,
23,
284,
220,
19,
20,
198,
1024,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_jump() {
let (jump, count) = Jump::parse("JGT").unwrap();
assert_eq!(jump, Jump::JGT);
assert_eq!(count, "");
let (jump, count) = Jump::parse("JMP ").unwrap();
assert_eq!(jump, Jump::JMP);
assert_eq!(count, "");
let (jump, count) = Jump::parse(";JMP").unwrap();
assert_eq!(jump, Jump::JMP);
assert_eq!(count, "");
let (jump, count) = Jump::parse("JMP //foo").unwrap();
assert_eq!(jump, Jump::JMP);
assert_eq!(count, " //foo");
let (jump, count) = Jump::parse("").unwrap();
assert_eq!(jump, Jump::None);
assert_eq!(count, "");
let err = Jump::parse("JM");
assert!(err.is_err());
} | rust_cleaned_test_functions.jsonl/134383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
65436,
368,
341,
286,
1077,
320,
43296,
11,
1760,
8,
284,
28788,
486,
6400,
445,
41,
25388,
1827,
15454,
543,
286,
2060,
10714,
10297,
43296,
11,
28788,
486,
41,
25388,
317,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dep_graph_delta_iter_empty() {
let x = DepGraphDelta::new();
let v: Vec<_> = x.iter().collect();
assert_eq!(v.len(), 0);
} | rust_cleaned_test_functions.jsonl/3504 | {
"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,
49258,
14738,
26710,
11723,
15124,
368,
341,
286,
1077,
856,
284,
4148,
11212,
20277,
486,
931,
543,
286,
1077,
348,
25,
11312,
32399,
29,
284,
856,
19471,
1005,
17384,
543,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_bytes_wide_maximum() {
assert_eq!(
Scalar([
0xc62c1805439b73b1,
0xc2b9551e8ced218e,
0xda44ec81daf9a422,
0x5605aa601c162e79
]),
Scalar::from_bytes_wide(&[0xff; 64])
);
} | rust_cleaned_test_functions.jsonl/90465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
12524,
1670,
577,
93581,
368,
341,
262,
2060,
10714,
33673,
286,
35176,
8956,
310,
220,
15,
8148,
21,
17,
66,
16,
23,
15,
20,
19,
18,
24,
65,
22,
18,
65,
16,
345,
310,
220,
15,
8148,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type_prefix_extraction() {
assert!(extract_type_prefix("test").is_none());
assert!(extract_type_prefix("://test").is_none());
assert!(extract_type_prefix("some:prefix://test").is_none());
assert!(extract_type_prefix("some/prefix://test").is_none());
assert_eq!(extract_type_prefix("http://test").unwrap(), "http");
assert_eq!(extract_type_prefix("a://test").unwrap(), "a");
} | rust_cleaned_test_functions.jsonl/6818 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
13974,
94842,
368,
341,
286,
2060,
10297,
23493,
1819,
13974,
445,
1944,
1827,
285,
31488,
1423,
286,
2060,
10297,
23493,
1819,
13974,
445,
1110,
1944,
1827,
285,
31488,
1423,
286,
2060,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_code_fetch() {
let (_temp_dir, deno_dir) = test_setup();
let cwd = std::env::current_dir().unwrap();
let cwd_string = String::from(cwd.to_str().unwrap()) + "/";
// Test failure case.
let specifier = "hello.ts";
let referrer = add_root!("/baddir/badfile.ts");
let r = deno_dir.code_fetch(specifier, referrer);
assert!(r.is_err());
// Assuming cwd is the deno repo root.
let specifier = "./js/main.ts";
let referrer = cwd_string.as_str();
let r = deno_dir.code_fetch(specifier, referrer);
assert!(r.is_ok());
} | rust_cleaned_test_functions.jsonl/72747 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4136,
11803,
368,
341,
262,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
1428,
262,
1077,
46938,
284,
1460,
486,
3160,
486,
3231,
4334,
1005,
15454,
543,
262,
1077,
46938,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_suffixes() {
let e = List::one(3).cons(4).cons(1).cons(2);
let e = e.suffixes();
assert_eq!(e.tail().head().tail().head(), &4);
} | rust_cleaned_test_functions.jsonl/40673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37151,
288,
368,
341,
1789,
286,
1077,
384,
284,
1759,
486,
603,
7,
18,
568,
6254,
7,
19,
568,
6254,
7,
16,
568,
6254,
7,
17,
317,
286,
1077,
384,
284,
384,
514,
13554,
288,
543,
286,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unescape_c_escape_string() {
assert_eq!(
&b"hello world"[..],
&unescape_c_escape_string("hello world")[..]
);
assert_eq!(&b"\0"[..], &unescape_c_escape_string(r#"\0"#)[..]);
assert_eq!(
&[0o012, 0o156],
&unescape_c_escape_string(r#"\012\156"#)[..]
);
assert_eq!(&[0x01, 0x02], &unescape_c_escape_string(r#"\x01\x02"#)[..]);
assert_eq!(
&b"\0\x01\x07\x08\x0C\n\r\t\x0B\\\'\"\xFE"[..],
&unescape_c_escape_string(r#"\0\001\a\b\f\n\r\t\v\\\'\"\xfe"#)[..]
);
} | rust_cleaned_test_functions.jsonl/10710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
12998,
666,
21832,
3904,
368,
341,
286,
2060,
10714,
33673,
310,
609,
65,
1,
14990,
1879,
36864,
496,
1259,
310,
609,
8531,
5330,
666,
21832,
3904,
445,
14990,
1879,
17135,
496,
921,
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_allocator() {
use impls::RWIobuf;
use self::Allocator;
struct MyAllocator;
impl Allocator for MyAllocator {
fn allocate(&self, size: usize, align: usize) -> *mut u8 {
unsafe {
Heap.alloc(Layout::from_size_align(size, align).unwrap())
.expect("could not allocate memory")
}
}
fn deallocate(&self, ptr: NonZero<*mut u8>, len: usize, align: usize) {
unsafe {
Heap.dealloc(ptr.get(), Layout::from_size_align(len, align).unwrap())
}
}
}
RWIobuf::new_with_allocator(1000, Arc::new(Box::new(MyAllocator)));
} | rust_cleaned_test_functions.jsonl/109446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56910,
368,
341,
220,
990,
11605,
82,
486,
56368,
40,
18464,
280,
220,
990,
656,
486,
42730,
401,
220,
2036,
3017,
42730,
401,
220,
11605,
80332,
369,
3017,
42730,
341,
262,
5168,
22089,
2099,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_again_after_voting_ends() {
let context = get_context("alice.near".to_string());
let validators = HashMap::from_iter(vec![("alice.near".to_string(), 100)].into_iter());
testing_env!(context, Default::default(), Default::default(), validators);
let mut contract = VotingContract::new();
contract.vote(true);
assert!(contract.result.is_some());
contract.vote(true);
} | rust_cleaned_test_functions.jsonl/3915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
62427,
19844,
2273,
11519,
90729,
368,
341,
286,
1077,
2266,
284,
633,
8467,
445,
63195,
1253,
682,
3263,
983,
3904,
1423,
286,
1077,
38588,
284,
10528,
486,
1499,
11723,
25592,
20703,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_byte_size() {
let mut u = Unstructured::new(&[1, 2, 3, 4, 5, 6, 7, 8, 9, 6]);
// Should take one byte off the end
assert_eq!(u.arbitrary_byte_size().unwrap(), 6);
assert_eq!(u.len(), 9);
let mut v = vec![];
v.resize(260, 0);
v.push(1);
v.push(4);
let mut u = Unstructured::new(&v);
// Should read two bytes off the end
assert_eq!(u.arbitrary_byte_size().unwrap(), 0x104);
assert_eq!(u.len(), 260);
} | rust_cleaned_test_functions.jsonl/20095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
2368,
368,
341,
286,
1077,
5206,
575,
284,
1230,
51143,
486,
931,
2099,
58,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normalize() {
let mut v1 = Vec4::new(1.0, 2.0, 3.0, 4.0);
let sq = (14.0_f64).sqrt();
let v2 = Vec4::new(1.0/sq, 2.0/sq, 3.0/sq, 4.0/sq);
v1.normalize();
assert_eq!(v1, v2);
} | rust_cleaned_test_functions.jsonl/38333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80807,
368,
341,
286,
1077,
5206,
348,
16,
284,
11312,
19,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
11,
220,
19,
13,
15,
317,
286,
1077,
18031,
284,
320,
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_parse_example_1() {
let file = parse_img("ex1.jpg");
assert_eq!(file.file_size, 3476);
let exif = file.exif_metadata();
assert_eq!(
get_tag!(exif, DateTimeOriginal, 0),
Some(&IFDDataContents::AsciiString(
"2021:12:11 23:59:59".to_string()
))
);
// Check GPS coordinates
let longitude = get_tag!(exif, GPSLongitude, ..).unwrap();
let longitude = get_degrees(longitude).unwrap();
assert_eq!(longitude, 0.1257400);
let latitude = get_tag!(exif, GPSLatitude, ..).unwrap();
let latitude = get_degrees(latitude).unwrap();
assert_eq!(latitude, 51.5085300);
// Check the JPEG comments
let comments = file.comments();
assert_eq!(comments, vec!["This is a test comment!"]);
// Additional tests
check_segment_sizes_sum_to_file_size(&file);
} | rust_cleaned_test_functions.jsonl/128658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
39304,
62,
16,
368,
341,
286,
1077,
1034,
284,
4715,
8918,
445,
327,
16,
4819,
797,
286,
2060,
10714,
10297,
1192,
9715,
2368,
11,
220,
18,
19,
22,
21,
626,
286,
1077,
505,
333,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ldxh_all2() {
test_interpreter_and_jit_asm!(
"
mov r0, r1
ldxh r9, [r0+0]
be16 r9
ldxh r8, [r0+2]
be16 r8
ldxh r7, [r0+4]
be16 r7
ldxh r6, [r0+6]
be16 r6
ldxh r5, [r0+8]
be16 r5
ldxh r4, [r0+10]
be16 r4
ldxh r3, [r0+12]
be16 r3
ldxh r2, [r0+14]
be16 r2
ldxh r1, [r0+16]
be16 r1
ldxh r0, [r0+18]
be16 r0
or r0, r1
or r0, r2
or r0, r3
or r0, r4
or r0, r5
or r0, r6
or r0, r7
or r0, r8
or r0, r9
exit",
[
0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08,
0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80,
0x01, 0x00, 0x02, 0x00,
],
(),
{ |_vm, res: Result| { res.unwrap() == 0x3ff } },
31
);
} | rust_cleaned_test_functions.jsonl/58989 | {
"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,
50573,
87,
71,
5705,
17,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
15,
11,
435,
16,
198,
286,
326,
12719,
71,
435,
24,
11,
508,
81,
15,
10,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mask_match() {
let cases = [
("abc", "abc", true),
("*", "abc", true),
("*c", "abc", true),
("a*", "a", true),
("a*", "abc", true),
("a*/b", "abc/b", true),
("a*b?c*x", "abxbbxdbxebxczzx", true),
("a*b?c*x", "abxbbxdbxebxczzy", false),
("a?b", "a☺b", true),
("a???b", "a☺b", false),
("*x", "xxx", true),
];
for (mask, s, is_match) in &cases {
assert_eq!(
match_mask(mask, s),
*is_match,
"match_mask({:?}, {:?})",
mask,
s
);
}
} | rust_cleaned_test_functions.jsonl/98 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 481
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9999,
10708,
368,
341,
286,
1077,
5048,
284,
2278,
310,
3489,
13683,
497,
330,
13683,
497,
830,
1326,
310,
3489,
78729,
330,
13683,
497,
830,
1326,
310,
3489,
9,
66,
497,
330,
13683,
497,
830,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ba1c() {
let seq = String::from("AAAACCCGGT");
assert_eq!(revcomp(&seq), String::from("ACCGGGTTTT"));
} | rust_cleaned_test_functions.jsonl/93823 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 63
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
64,
16,
66,
368,
341,
262,
1077,
12981,
284,
923,
486,
1499,
445,
50107,
1706,
3706,
22254,
51,
797,
262,
2060,
10714,
10297,
7282,
5689,
2099,
13262,
701,
923,
486,
1499,
445,
1706,
8798,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_response_first_line() {
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec![
"me".to_string(),
"8BITMIME".to_string(),
"SIZE 42".to_string(),
],
)
.first_line(),
Some("me")
);
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec![
"me mo".to_string(),
"8BITMIME".to_string(),
"SIZE 42".to_string(),
],
)
.first_line(),
Some("me mo")
);
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec![],
)
.first_line(),
None
);
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec![" ".to_string()],
)
.first_line(),
Some(" ")
);
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec![" ".to_string()],
)
.first_line(),
Some(" ")
);
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec!["".to_string()],
)
.first_line(),
Some("")
);
} | rust_cleaned_test_functions.jsonl/10046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9655,
12978,
6528,
368,
341,
286,
2060,
10714,
33673,
310,
5949,
486,
931,
1006,
394,
6119,
341,
503,
29920,
25,
51139,
486,
48183,
38489,
33190,
345,
503,
5582,
25,
10054,
486,
16702,
2320,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build_payload_adds_a_result_for_each_interaction() {
let result = TestResult::Ok(vec![Some("1".to_string()), Some("2".to_string()), Some("3".to_string()), None]);
let payload = super::build_payload(result, "1".to_string(), Some("http://build-url".to_string()));
expect!(payload).to(be_equal_to(json!({
"providerApplicationVersion": "1",
"success": true,
"buildUrl": "http://build-url",
"testResults": [
{ "interactionId": "1", "success": true },
{ "interactionId": "2", "success": true },
{ "interactionId": "3", "success": true }
],
"verifiedBy": {
"implementation": "Pact-Rust",
"version": PACT_RUST_VERSION
}
})));
} | rust_cleaned_test_functions.jsonl/19550 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
32813,
2891,
82,
4306,
5287,
5478,
32046,
97394,
368,
341,
262,
1077,
1102,
284,
3393,
2077,
486,
11578,
25592,
20703,
8373,
445,
16,
3263,
983,
3904,
11858,
4329,
445,
17,
3263,
983,
3904,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proof_path_prefix() {
let b = ProofPath::from_raw(*b"\x00\x83wertyuiopasdfghjklzxcvbnm123456\x08");
assert_eq!(b.len(), 8);
assert_eq!(b.prefix(1).bit(0), ChildKind::Right);
assert_eq!(b.prefix(1).len(), 1);
} | rust_cleaned_test_functions.jsonl/25537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86757,
2638,
13974,
368,
341,
262,
1077,
293,
284,
36991,
1820,
486,
1499,
16067,
4071,
65,
11934,
87,
15,
15,
3462,
23,
18,
86,
1344,
1963,
453,
76615,
866,
73,
10561,
89,
8148,
85,
11081,
76... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_routing_with_region() {
let route = RouteBuilder::new()
.platform(Platform::Pc)
.region(Some(Region::Apac))
.build();
assert_eq!(route.path(), api!("/leaderboard/pc/apac"));
} | rust_cleaned_test_functions.jsonl/55385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
97710,
6615,
20627,
368,
341,
286,
1077,
6021,
284,
9572,
3297,
486,
931,
741,
310,
659,
15734,
7,
17296,
486,
47,
66,
340,
310,
659,
3943,
65405,
7,
14091,
486,
10611,
580,
1171,
310,
659,
58... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_create_credential_def_no_fees_real() {
let _setup = SetupLibraryWalletPoolZeroFees::init();
let (_, handle) = create_cred_def_real(false);
let _source_id = get_source_id(handle).unwrap();
let _cred_def_id = get_cred_def_id(handle).unwrap();
let _schema_json = to_string(handle).unwrap();
// No Payment performed
let _payment = get_cred_def_payment_txn(handle).unwrap_err();
} | rust_cleaned_test_functions.jsonl/96768 | {
"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,
8657,
666,
30320,
7844,
6536,
761,
5516,
15266,
368,
341,
286,
1077,
716,
15188,
284,
18626,
16915,
38259,
10551,
17999,
37,
5516,
486,
2327,
1428,
286,
1077,
39464,
3705,
8,
284,
1855,
73475,
784... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_message_to_handle_from_responded_state() {
let _setup = SetupIndyMocks::init();
let connection = inviter_sm().to_inviter_responded_state();
// Ping
{
let messages = map!(
"key_1".to_string() => A2AMessage::Ping(_ping()),
"key_2".to_string() => A2AMessage::ConnectionRequest(_request()),
"key_3".to_string() => A2AMessage::ConnectionResponse(_signed_response())
);
let (uid, message) = connection.find_message_to_handle(messages).unwrap();
assert_eq!("key_1", uid);
assert_match!(A2AMessage::Ping(_), message);
}
// Ack
{
let messages = map!(
"key_1".to_string() => A2AMessage::ConnectionRequest(_request()),
"key_2".to_string() => A2AMessage::Ack(_ack()),
"key_3".to_string() => A2AMessage::ConnectionResponse(_signed_response())
);
let (uid, message) = connection.find_message_to_handle(messages).unwrap();
assert_eq!("key_2", uid);
assert_match!(A2AMessage::Ack(_), message);
}
// Connection Problem Report
{
let messages = map!(
"key_1".to_string() => A2AMessage::ConnectionRequest(_request()),
"key_2".to_string() => A2AMessage::ConnectionProblemReport(_problem_report())
);
let (uid, message) = connection.find_message_to_handle(messages).unwrap();
assert_eq!("key_2", uid);
assert_match!(A2AMessage::ConnectionProblemReport(_), message);
}
// No messages
{
let messages = map!(
"key_1".to_string() => A2AMessage::ConnectionRequest(_request()),
"key_2".to_string() => A2AMessage::ConnectionResponse(_signed_response())
);
assert!(connection.find_message_to_handle(messages).is_none());
}
} | rust_cleaned_test_functions.jsonl/29147 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
6462,
2346,
10630,
5673,
4918,
3511,
291,
4387,
368,
341,
394,
1077,
716,
15188,
284,
18626,
1425,
88,
72577,
486,
2327,
1428,
394,
1077,
3633,
284,
1529,
2015,
15874,
1005,
983,
19996,
201... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_private_key() {
let (env, op_tool, backend, storage) = launch_swarm_with_op_tool_and_backend(1, 0);
// Extract the operator private key to file
let (_, node_config_path) = load_node_config(&env.validator_swarm, 0);
let key_file_path = node_config_path.with_file_name(OPERATOR_KEY);
let _ = op_tool
.extract_private_key(OPERATOR_KEY, key_file_path.to_str().unwrap(), &backend)
.unwrap();
// Verify the operator private key has been written correctly
let file_contents = fs::read(key_file_path).unwrap();
let key_from_file = lcs::from_bytes(&file_contents).unwrap();
let key_from_storage = storage.export_private_key(OPERATOR_KEY).unwrap();
assert_eq!(key_from_storage, key_from_file);
} | rust_cleaned_test_functions.jsonl/64963 | {
"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,
39123,
26249,
3097,
368,
341,
262,
1077,
320,
3160,
11,
1179,
22785,
11,
19163,
11,
5819,
8,
284,
7050,
32581,
2178,
6615,
10287,
22785,
8378,
40011,
7,
16,
11,
220,
15,
626,
262,
442,
22826,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_csp_culprit_0() {
let json = r#"{
"csp-report": {
"document-uri": "http://example.com/foo",
"violated-directive": "style-src http://cdn.example.com",
"effective-directive": "style-src"
}
}"#;
let mut event = Event::default();
Csp::apply_to_event(json.as_bytes(), &mut event).unwrap();
insta::assert_debug_snapshot!(event.culprit, @r###""style-src http://cdn.example.com""###);
} | rust_cleaned_test_functions.jsonl/4020 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2154,
666,
360,
39707,
62,
15,
368,
341,
286,
1077,
2951,
284,
435,
55543,
515,
310,
330,
66,
2154,
47411,
788,
341,
394,
330,
6062,
87232,
788,
330,
1254,
1110,
8687,
905,
60555,
756,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sort_by_suffix() -> Result<()> {
let df = fruits_cars();
let out = df
.lazy()
.select([col("*")
.sort_by([col("A")], [false])
.list()
.over([col("fruits")])
.flatten()
.suffix("_sorted")])
.collect()?;
let expected = df!(
"A_sorted"=> [1, 2, 5, 3, 4],
"fruits_sorted"=> ["banana", "banana", "banana", "apple", "apple"],
"B_sorted"=> [5, 4, 1, 3, 2],
"cars_sorted"=> ["beetle", "audi", "beetle", "beetle", "beetle"]
)?;
assert!(expected.frame_equal(&out));
Ok(())
} | rust_cleaned_test_functions.jsonl/170 | {
"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,
18435,
3710,
37151,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
284,
25322,
666,
1561,
543,
262,
1077,
700,
284,
6764,
198,
286,
659,
49013,
741,
286,
659,
1742,
2561,
2074,
29592,
1138,
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_transaction_info_roundtrip() {
let mut blockchain = create_blockchain();
let tx = tx_generator().next().unwrap();
let mut fork = blockchain.fork();
{
let mut schema = Schema::new(&mut fork);
schema.add_transaction_into_pool(tx.clone());
}
blockchain.merge(fork.into_patch()).unwrap();
let explorer = BlockchainExplorer::new(&blockchain);
let info: TransactionInfo = explorer.transaction(&tx.hash()).unwrap();
let json = serde_json::to_value(&info).unwrap();
let info: TransactionInfo = serde_json::from_value(json).unwrap();
assert_eq!(info.content().message(), &tx);
} | rust_cleaned_test_functions.jsonl/70360 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
3109,
29896,
32981,
368,
341,
262,
1077,
5206,
17944,
284,
1855,
7113,
8819,
543,
262,
1077,
9854,
284,
9854,
25813,
1005,
3600,
1005,
15454,
1428,
262,
1077,
5206,
22435,
284,
17944,
833,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_err() {
const E_EMPTY: &str = "cannot parse float from empty string";
const E_FORMAT: &str = "invalid float literal";
const E_LEN: &str = "Incorrect number of values. Bounds expects four f64 values.";
let err_to_str = |v| Bounds::from_str(v).unwrap_err().to_string();
assert_eq!(err_to_str(""), E_EMPTY);
assert_eq!(err_to_str("1"), E_LEN);
assert_eq!(err_to_str("1,2,3"), E_LEN);
assert_eq!(err_to_str("1,2,3,4,5"), E_LEN);
assert_eq!(err_to_str("1,2,3,a"), E_FORMAT);
} | rust_cleaned_test_functions.jsonl/107205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9266,
368,
341,
286,
733,
468,
36640,
25,
609,
495,
284,
330,
33260,
4715,
2224,
504,
4287,
914,
876,
286,
733,
468,
14960,
25,
609,
495,
284,
330,
11808,
2224,
23141,
876,
286,
733,
46... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array() -> Result<()> {
generic_test_array(
Arc::new(StringArray::from(vec!["aa"])),
Arc::new(StringArray::from(vec!["bb"])),
DataType::Utf8,
"StringArray\n[\n \"aa\",\n \"bb\",\n]",
)?;
generic_test_array(
Arc::new(UInt32Array::from(vec![1u32])),
Arc::new(UInt64Array::from(vec![1u64])),
DataType::UInt64,
"PrimitiveArray<UInt64>\n[\n 1,\n 1,\n]",
)?;
generic_test_array(
Arc::new(UInt64Array::from(vec![1u64])),
Arc::new(UInt32Array::from(vec![1u32])),
DataType::UInt64,
"PrimitiveArray<UInt64>\n[\n 1,\n 1,\n]",
)
} | rust_cleaned_test_functions.jsonl/34137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 463
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
368,
1464,
5714,
71698,
341,
286,
13954,
4452,
3858,
1006,
310,
19689,
486,
931,
2242,
1857,
486,
1499,
25592,
0,
1183,
5305,
1341,
6965,
310,
19689,
486,
931,
2242,
1857,
486,
1499,
25592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_url_from_file_path() {
use std::path::PathBuf;
use url::Url;
let p = PathBuf::from("c:///");
let u = Url::from_file_path(p).unwrap();
let path = u.to_file_path().unwrap();
assert_eq!("C:\\", path.to_str().unwrap());
} | rust_cleaned_test_functions.jsonl/79051 | {
"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,
2903,
5673,
2458,
2638,
368,
341,
262,
990,
1460,
486,
2343,
486,
1820,
15064,
280,
262,
990,
2515,
486,
2864,
401,
262,
1077,
281,
284,
7933,
15064,
486,
1499,
445,
66,
1110,
49897,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tick() {
let mut event_loop = EventLoop::new().unwrap();
let sender = event_loop.channel();
sender.send(0).unwrap();
event_loop.run(&mut TickHandler).unwrap();
} | rust_cleaned_test_functions.jsonl/19985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43612,
368,
341,
262,
1077,
5206,
1538,
17198,
284,
3665,
14620,
486,
931,
1005,
15454,
543,
262,
1077,
4646,
284,
1538,
17198,
16195,
543,
262,
4646,
5219,
7,
15,
568,
15454,
543,
262,
1538,
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 |
#[test]
fn test_is_true() {
let test_cases = vec![
(ScalarValue::Int(None), ScalarFuncSig::IntIsTrue, Some(0)),
(0.into(), ScalarFuncSig::IntIsTrue, Some(0)),
(1.into(), ScalarFuncSig::IntIsTrue, Some(1)),
(ScalarValue::Real(None), ScalarFuncSig::RealIsTrue, Some(0)),
(0.0.into(), ScalarFuncSig::RealIsTrue, Some(0)),
(1.0.into(), ScalarFuncSig::RealIsTrue, Some(1)),
(
ScalarValue::Decimal(None),
ScalarFuncSig::DecimalIsTrue,
Some(0),
),
(
Decimal::zero().into(),
ScalarFuncSig::DecimalIsTrue,
Some(0),
),
(
Decimal::from(1).into(),
ScalarFuncSig::DecimalIsTrue,
Some(1),
),
];
for (arg, sig, expect_output) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg.clone())
.evaluate(sig)
.unwrap();
assert_eq!(output, expect_output, "{:?}, {:?}", arg, sig);
}
} | rust_cleaned_test_functions.jsonl/87512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 713
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
16082,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
20639,
1130,
486,
1072,
26717,
701,
35176,
9626,
47246,
486,
1072,
3872,
2514,
11,
4329,
7,
15,
6965,
310,
320,
15,
398... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_incremental_with_nonfatal_read_error() {
let mut d = MessageDeframer::new();
assert_len(3, input_bytes(&mut d, &FIRST_MESSAGE[..3]));
input_error(&mut d);
assert_len(FIRST_MESSAGE.len() - 3,
input_bytes(&mut d, &FIRST_MESSAGE[3..]));
assert_eq!(d.frames.len(), 1);
pop_first(&mut d);
assert_eq!(d.has_pending(), false);
} | rust_cleaned_test_functions.jsonl/29508 | {
"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,
51482,
278,
6615,
21637,
74394,
6443,
4096,
368,
341,
286,
1077,
5206,
294,
284,
4856,
2620,
46369,
486,
931,
543,
286,
2060,
6043,
7,
18,
11,
1946,
12524,
2099,
6984,
294,
11,
609,
67792,
14641... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inc_binary()
{
let mut d = BinaryDigit(0u8);
let overflow = d.inc();
assert!(!overflow);
assert_eq!(d, BinaryDigit(1));
let mut d = BinaryDigit(0xfeu8);
let overflow = d.inc();
assert!(!overflow);
assert_eq!(d, BinaryDigit(0xff));
let mut d = BinaryDigit(0xffu8);
let overflow = d.inc();
assert!(overflow);
assert_eq!(d, BinaryDigit(0));
let mut d = BinaryDigit(0xffu16);
let overflow = d.inc();
assert!(!overflow);
assert_eq!(d, BinaryDigit(0x100));
let mut d = BinaryDigit(0xffffu16);
let overflow = d.inc();
assert!(overflow);
assert_eq!(d, BinaryDigit(0));
let mut d = BinaryDigit(0xfffffu32);
let overflow = d.inc();
assert!(!overflow);
assert_eq!(d, BinaryDigit(0x100000));
let mut d = BinaryDigit(0xffffffffu32);
let overflow = d.inc();
assert!(overflow);
assert_eq!(d, BinaryDigit(0));
} | rust_cleaned_test_functions.jsonl/26385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 539
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31285,
31761,
741,
262,
341,
286,
1077,
5206,
294,
284,
17718,
36420,
7,
15,
84,
23,
317,
286,
1077,
16484,
284,
294,
26797,
543,
286,
2060,
0,
3471,
20823,
317,
286,
2060,
10714,
10297,
67,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arena_index_mut() {
let mut arena = Arena::new();
let index0 = arena.insert("test");
let index1 = arena.insert("foo");
assert_eq!(2, arena.len());
assert_eq!("test", arena[index0]);
let element = &mut arena[index0];
*element = "bar";
assert_eq!("bar", arena[index0]);
assert_eq!("foo", arena[index1]);
} | rust_cleaned_test_functions.jsonl/30773 | {
"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,
62,
30527,
3560,
29523,
368,
341,
286,
1077,
5206,
24902,
284,
27047,
486,
931,
543,
286,
1077,
1922,
15,
284,
24902,
7030,
445,
1944,
797,
286,
1077,
1922,
16,
284,
24902,
7030,
445,
7975,
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_fr_invert() {
assert!(bool::from(Fr::zero().invert().is_none()));
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
0xe5,
]);
let one = Fr::one();
for _ in 0..1000 {
// Ensure that a * a^-1 = 1
let mut a = Fr::random(&mut rng);
let ainv = a.invert().unwrap();
a.mul_assign(&ainv);
assert_eq!(a, one);
}
} | rust_cleaned_test_functions.jsonl/100651 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
1243,
1621,
368,
341,
262,
2060,
10297,
2641,
486,
1499,
7832,
81,
486,
14154,
1005,
83729,
1005,
285,
31488,
25138,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_header() {
let value =
HeaderValue::from_static("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
let scheme = Basic::parse(&value);
assert!(scheme.is_ok());
let scheme = scheme.unwrap();
assert_eq!(scheme.user_id, "Aladdin");
assert_eq!(scheme.password, Some("open sesame".into()));
} | rust_cleaned_test_functions.jsonl/27908 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8757,
368,
341,
286,
1077,
897,
4035,
310,
12104,
1130,
486,
1499,
25360,
445,
15944,
1207,
54,
87,
71,
57,
8626,
16650,
46054,
7362,
39718,
84,
40,
43165,
17257,
17,
37,
83,
57,
48,
41... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_associated_type_templated_typedef() {
let hdr = indoc! {"
#include <string>
#include <cstdint>
template <typename STRING_TYPE> class BasicStringPiece {
public:
typedef size_t size_type;
typedef typename STRING_TYPE::value_type value_type;
const value_type* ptr_;
size_type length_;
};
typedef BasicStringPiece<std::string> StringPiece;
struct Origin {
// void SetHost(StringPiece host);
StringPiece host;
};
"};
let rs = quote! {
ffi::Origin::make_unique();
};
run_test("", hdr, rs, &["Origin"], &[]);
} | rust_cleaned_test_functions.jsonl/9822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58665,
657,
1819,
528,
25892,
657,
42111,
4219,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
917,
397,
286,
671,
997,
366,
96975,
1339,
286,
3811,
366,
9031,
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_disruptive_follower() {
let l = default_logger();
let mut n1 = new_test_raft(1, vec![1, 2, 3], 10, 1, new_storage(), &l);
let mut n2 = new_test_raft(2, vec![1, 2, 3], 10, 1, new_storage(), &l);
let mut n3 = new_test_raft(3, vec![1, 2, 3], 10, 1, new_storage(), &l);
n1.check_quorum = true;
n2.check_quorum = true;
n3.check_quorum = true;
n1.become_follower(1, INVALID_ID);
n2.become_follower(1, INVALID_ID);
n3.become_follower(1, INVALID_ID);
let mut nt = Network::new(vec![Some(n1), Some(n2), Some(n3)], &l);
nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
// check state
assert_eq!(nt.peers[&1].state, StateRole::Leader);
assert_eq!(nt.peers[&2].state, StateRole::Follower);
assert_eq!(nt.peers[&3].state, StateRole::Follower);
// etcd server "advanceTicksForElection" on restart;
// this is to expedite campaign trigger when given larger
// Or leader messages are being delayed while ticks elapse
let timeout = nt.peers[&3].election_timeout();
nt.peers
.get_mut(&3)
.unwrap()
.set_randomized_election_timeout(timeout + 2);
let timeout = nt.peers[&3].randomized_election_timeout();
for _ in 0..timeout - 1 {
nt.peers.get_mut(&3).unwrap().tick();
}
nt.peers.get_mut(&3).unwrap().tick();
// n1 is still leader yet
// while its heartbeat to candidate n3 is being delayed
// check state
assert_eq!(nt.peers[&1].state, StateRole::Leader);
assert_eq!(nt.peers[&2].state, StateRole::Follower);
assert_eq!(nt.peers[&3].state, StateRole::Candidate);
// check term
// n1.Term == 2
// n2.Term == 2
// n3.Term == 3
assert_eq!(nt.peers[&1].term, 2);
assert_eq!(nt.peers[&2].term, 2);
assert_eq!(nt.peers[&3].term, 3);
// leader heartbeat finally arrives at candidate n3
// heartbeat was sent with lower term than candidate's
let mut msg = new_message(1, 3, MessageType::MsgHeartbeat, 0);
msg.term = nt.peers[&1].term;
nt.send(vec![msg]);
// then candidate n3 responds with "pb.MsgAppResp" of higher term
// and leader steps down from a message with higher term
// with higher term can be freed with following election
// check state
assert_eq!(nt.peers[&1].state, StateRole::Follower);
assert_eq!(nt.peers[&2].state, StateRole::Follower);
assert_eq!(nt.peers[&3].state, StateRole::Candidate);
// check term
// n1.Term == 3
// n2.Term == 2
// n3.Term == 3
assert_eq!(nt.peers[&1].term, 3);
assert_eq!(nt.peers[&2].term, 2);
assert_eq!(nt.peers[&3].term, 3);
} | rust_cleaned_test_functions.jsonl/19123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9932,
6585,
533,
761,
29034,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
308,
16,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
1125,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_generate_merge_list_01() {
let mut server = new_temp_server();
let (_tmp_dir, tmp_path) = copy_to_and_set_root("./testdata/01", &mut server);
server.endpoint.request_shutdown();
let final_idx = server.graph.borrow_mut()
.add_node(&tmp_path.join("shaders").join("final.fsh"));
let common_idx = server.graph.borrow_mut()
.add_node(&tmp_path.join("shaders").join("common.glsl"));
server.graph.borrow_mut().add_edge(
final_idx,
common_idx,
IncludePosition {
line: 2,
start: 0,
end: 0,
},
);
let nodes = server.get_dfs_for_node(final_idx).unwrap();
let sources = server.load_sources(&nodes).unwrap();
let graph_borrow = server.graph.borrow();
let result = merge_views::generate_merge_list(&nodes, &sources, &graph_borrow);
let merge_file = tmp_path.clone().join( "shaders").join("final.fsh.merge");
let mut truth = fs::read_to_string(merge_file).unwrap();
truth = truth.replacen("!!", &tmp_path.clone().join("shaders").join("common.glsl").to_str().unwrap().replace("\\", "\\\\"), 1);
truth = truth.replace("!!", &tmp_path.join("shaders").join("final.fsh").to_str().unwrap().replace("\\", "\\\\"));
assert_eq!(result, truth);
} | rust_cleaned_test_functions.jsonl/56157 | {
"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,
48851,
20888,
2019,
62,
15,
16,
368,
341,
262,
1077,
5206,
3538,
284,
501,
11771,
12015,
1428,
262,
1077,
5453,
5173,
4334,
11,
4174,
2638,
8,
284,
2975,
2346,
8378,
2602,
12993,
13988,
92425,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_set() {
let mut buf = BufferVec::new();
for v in vec!["a", "b", "c"] {
buf.push(v)
}
let s = Set {
data: Arc::new(buf),
value: 0b101,
};
assert!(s.as_ref().is_set(0));
assert!(!s.as_ref().is_set(1));
assert!(s.as_ref().is_set(2));
} | rust_cleaned_test_functions.jsonl/106657 | {
"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,
6892,
2602,
368,
341,
286,
1077,
5206,
6607,
284,
10312,
10050,
486,
931,
543,
286,
369,
348,
304,
7486,
0,
1183,
64,
497,
330,
65,
497,
330,
66,
1341,
341,
310,
6607,
2552,
3747,
340,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_check_vote_threshold_above_threshold_no_stake() {
let mut tower = Tower::new_for_tests(1, 0.67);
let stakes = HashMap::new();
tower.record_vote(0, Hash::default());
assert!(!tower.check_vote_stake_threshold(1, &stakes, 2));
} | rust_cleaned_test_functions.jsonl/61142 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
54360,
21858,
77315,
21858,
6536,
1261,
726,
368,
341,
286,
1077,
5206,
21271,
284,
21938,
486,
931,
5478,
32509,
7,
16,
11,
220,
15,
13,
21,
22,
317,
286,
1077,
44425,
284,
10528,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_subcommand() {
let err = OptParseError::invalid_subcommand("new");
let thing = format!("{}", err);
let expect = "Invalid subcommand: new";
assert_eq!(thing, expect);
} | rust_cleaned_test_functions.jsonl/8278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
5228,
5631,
368,
341,
286,
1077,
1848,
284,
16554,
14463,
1454,
486,
11808,
5228,
5631,
445,
931,
797,
286,
1077,
3166,
284,
3561,
79878,
1848,
317,
286,
1077,
1720,
284,
330,
7928,
1186,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_saturating_add_int() {
use isize::{MIN,MAX};
assert_eq!(3i32.saturating_add(5), 8);
assert_eq!(3isize.saturating_add(MAX-1), MAX);
assert_eq!(MAX.saturating_add(MAX), MAX);
assert_eq!((MAX-2).saturating_add(1), MAX-1);
assert_eq!(3i32.saturating_add(-5), -2);
assert_eq!(MIN.saturating_add(-1), MIN);
assert_eq!((-2isize).saturating_add(-MAX), MIN);
} | rust_cleaned_test_functions.jsonl/21920 | {
"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,
643,
2628,
1095,
2891,
4042,
368,
341,
286,
990,
91373,
22964,
16413,
11,
10586,
2440,
286,
2060,
10714,
10297,
18,
72,
18,
17,
514,
2628,
1095,
2891,
7,
20,
701,
220,
23,
317,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_cache() {
string_1("a".into(), "b".into());
{
let cache = STRING_CACHE_EXPLICIT.lock().unwrap();
assert_eq!(1, cache.cache_size());
}
} | rust_cleaned_test_functions.jsonl/13128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
11529,
368,
341,
262,
914,
62,
16,
445,
64,
3263,
18122,
1507,
330,
65,
3263,
18122,
1423,
262,
341,
286,
1077,
6500,
284,
35255,
29138,
4966,
83094,
21003,
1005,
15454,
543,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_valid_vm_config_serial_pty_console_pty() {
vec![
(
vec!["cloud-hypervisor", "--kernel", "/path/to/kernel"],
r#"{
"kernel": {"path": "/path/to/kernel"},
"serial": {"mode": "Null"},
"console": {"mode": "Tty"}
}"#,
true,
),
(
vec![
"cloud-hypervisor",
"--kernel",
"/path/to/kernel",
"--serial",
"null",
"--console",
"tty",
],
r#"{
"kernel": {"path": "/path/to/kernel"}
}"#,
true,
),
(
vec![
"cloud-hypervisor",
"--kernel",
"/path/to/kernel",
"--serial",
"pty",
"--console",
"pty",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"serial": {"mode": "Pty"},
"console": {"mode": "Pty"}
}"#,
true,
),
]
.iter()
.for_each(|(cli, openapi, equal)| {
compare_vm_config_cli_vs_json(cli, openapi, *equal);
});
} | rust_cleaned_test_functions.jsonl/48723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1048
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
39008,
5332,
25602,
62,
1595,
51724,
62,
1595,
368,
341,
286,
7486,
90515,
310,
2399,
394,
7486,
0,
1183,
12361,
2832,
1082,
31396,
497,
14482,
23248,
497,
3521,
2343,
32429,
58343,
8097,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_with_year() {
let expression = "1 2 3 4 5 6 2015";
assert!(Schedule::from_str(expression).is_ok());
} | rust_cleaned_test_functions.jsonl/50804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6615,
14645,
368,
341,
286,
1077,
7493,
284,
330,
16,
220,
17,
220,
18,
220,
19,
220,
20,
220,
21,
220,
17,
15,
16,
20,
876,
286,
2060,
10297,
32210,
486,
1499,
2895,
48330,
568,
285,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_create_cache() {
let dir = TempDir::new().unwrap();
let mut cache_path = dir.path().to_owned();
cache_path.push("foobar");
// HttpCache should be created lazily on first use:
// when zipping up a local project with no external dependencies
// when directory is owned by root we might not be able
// to create that directory. However if it's not needed it
// doesn't make sense to return error in such specific scenarios.
// For more details check issue:
// https://github.com/denoland/deno/issues/5688
let cache = HttpCache::new(&cache_path);
assert!(!cache.location.exists());
cache
.set(
&Url::parse("http://example.com/foo/bar.js").unwrap(),
HeadersMap::new(),
b"hello world",
)
.expect("Failed to add to cache");
assert!(cache.ensure_dir_exists(&cache.location).is_ok());
assert!(cache_path.is_dir());
} | rust_cleaned_test_functions.jsonl/132671 | {
"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,
8657,
11529,
368,
341,
262,
1077,
5419,
284,
19944,
6184,
486,
931,
1005,
15454,
543,
262,
1077,
5206,
6500,
2638,
284,
5419,
3875,
1005,
983,
51973,
543,
262,
6500,
2638,
2552,
445,
50267,
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_xor_keystream_panic_on_too_much_keystream_data_ietf() {
let mut chacha_state_ietf = ChaCha20 {
state: [
U32x4(0, 0, 0, 0),
U32x4(0, 0, 0, 0),
U32x4(0, 0, 0, 0),
U32x4(0, 0, 0, 0),
],
internal_counter: (u32::max_value() - 128),
is_ietf: true,
};
let mut keystream_block = [0u8; CHACHA_BLOCKSIZE];
for amount in 0..(128 + 1) {
chacha_state_ietf.keystream_block(amount, &mut keystream_block);
}
} | rust_cleaned_test_functions.jsonl/44718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76462,
45476,
597,
1237,
620,
31270,
4470,
2346,
78,
717,
1387,
45476,
597,
1237,
1769,
62,
74068,
368,
341,
310,
1077,
5206,
521,
51576,
4387,
62,
74068,
284,
27721,
95971,
17,
15,
341,
394,
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_memtable_rewrite() {
let region_id = 8;
let mut memtable = MemTable::new(region_id, Arc::new(GlobalStats::default()));
let mut expected_append = 0;
let mut expected_rewrite = 0;
let mut expected_deleted_rewrite = 0;
// Rewrite to empty table.
let ents_idx = generate_entry_indexes(0, 10, FileId::new(LogQueue::Rewrite, 1));
memtable.rewrite(ents_idx, Some(1));
expected_rewrite += 10;
expected_deleted_rewrite += 10;
assert_eq!(memtable.min_file_seq(LogQueue::Rewrite), None);
assert_eq!(
memtable.global_stats.live_entries(LogQueue::Append),
expected_append
);
assert_eq!(memtable.global_stats.rewrite_entries(), expected_rewrite);
assert_eq!(
memtable.global_stats.deleted_rewrite_entries(),
expected_deleted_rewrite
);
// Append and compact:
memtable.append(generate_entry_indexes(
0,
10,
FileId::new(LogQueue::Append, 1),
));
memtable.append(generate_entry_indexes(
10,
20,
FileId::new(LogQueue::Append, 2),
));
memtable.put(
b"kk1".to_vec(),
b"vv1".to_vec(),
FileId::new(LogQueue::Append, 2),
);
memtable.append(generate_entry_indexes(
20,
30,
FileId::new(LogQueue::Append, 3),
));
memtable.put(
b"kk2".to_vec(),
b"vv2".to_vec(),
FileId::new(LogQueue::Append, 3),
);
memtable.append(generate_entry_indexes(
30,
40,
FileId::new(LogQueue::Append, 4),
));
memtable.put(
b"kk3".to_vec(),
b"vv3".to_vec(),
FileId::new(LogQueue::Append, 4),
);
expected_append += 4 * 10 + 3;
memtable.compact_to(10);
expected_append -= 10;
assert_eq!(memtable.entries_size(), 30);
assert_eq!(memtable.min_file_seq(LogQueue::Append).unwrap(), 2);
assert_eq!(memtable.max_file_seq(LogQueue::Append).unwrap(), 4);
assert_eq!(
memtable.global_stats.live_entries(LogQueue::Append),
expected_append
);
memtable.consistency_check();
// Rewrite compacted entries.
let ents_idx = generate_entry_indexes(0, 10, FileId::new(LogQueue::Rewrite, 50));
memtable.rewrite(ents_idx, Some(1));
memtable.rewrite_key(b"kk0".to_vec(), Some(1), 50);
expected_rewrite += 10 + 1;
expected_deleted_rewrite += 10 + 1;
assert_eq!(memtable.min_file_seq(LogQueue::Append).unwrap(), 2);
assert_eq!(memtable.max_file_seq(LogQueue::Append).unwrap(), 4);
assert!(memtable.min_file_seq(LogQueue::Rewrite).is_none());
assert!(memtable.max_file_seq(LogQueue::Rewrite).is_none());
assert_eq!(memtable.rewrite_count, 0);
assert_eq!(memtable.get(b"kk0"), None);
assert_eq!(
memtable.global_stats.live_entries(LogQueue::Append),
expected_append
);
assert_eq!(memtable.global_stats.rewrite_entries(), expected_rewrite);
assert_eq!(
memtable.global_stats.deleted_rewrite_entries(),
expected_deleted_rewrite
);
memtable.consistency_check();
// Mixed rewrite.
let ents_idx = generate_entry_indexes(0, 20, FileId::new(LogQueue::Rewrite, 100));
memtable.rewrite(ents_idx, Some(2));
memtable.rewrite_key(b"kk0".to_vec(), Some(1), 50);
memtable.rewrite_key(b"kk1".to_vec(), Some(2), 100);
expected_append -= 10 + 1;
expected_rewrite += 20 + 2;
expected_deleted_rewrite += 10 + 1;
let ents_idx = generate_entry_indexes(20, 30, FileId::new(LogQueue::Rewrite, 101));
memtable.rewrite(ents_idx, Some(3));
memtable.rewrite_key(b"kk2".to_vec(), Some(3), 101);
expected_append -= 10 + 1;
expected_rewrite += 10 + 1;
assert_eq!(memtable.min_file_seq(LogQueue::Append).unwrap(), 4);
assert_eq!(memtable.max_file_seq(LogQueue::Append).unwrap(), 4);
assert_eq!(memtable.min_file_seq(LogQueue::Rewrite).unwrap(), 100);
assert_eq!(memtable.max_file_seq(LogQueue::Rewrite).unwrap(), 101);
assert_eq!(memtable.rewrite_count, 20);
assert_eq!(memtable.get(b"kk1"), Some(b"vv1".to_vec()));
assert_eq!(
memtable.global_stats.live_entries(LogQueue::Append),
expected_append
);
assert_eq!(memtable.global_stats.rewrite_entries(), expected_rewrite);
assert_eq!(
memtable.global_stats.deleted_rewrite_entries(),
expected_deleted_rewrite
);
memtable.consistency_check();
// 35 file_num = 5
memtable.append(generate_entry_indexes(
35,
36,
FileId::new(LogQueue::Append, 5),
));
expected_append -= 4;
memtable.put(
b"kk3".to_vec(),
b"vv33".to_vec(),
FileId::new(LogQueue::Append, 5),
);
assert_eq!(memtable.last_index().unwrap(), 35);
memtable.consistency_check();
let ents_idx = generate_entry_indexes(30, 40, FileId::new(LogQueue::Rewrite, 102));
memtable.rewrite(ents_idx, Some(4));
expected_append -= 5;
expected_rewrite += 10;
expected_deleted_rewrite += 5;
assert_eq!(memtable.min_file_seq(LogQueue::Append).unwrap(), 5);
assert_eq!(memtable.max_file_seq(LogQueue::Append).unwrap(), 5);
assert_eq!(memtable.min_file_seq(LogQueue::Rewrite).unwrap(), 100);
assert_eq!(memtable.max_file_seq(LogQueue::Rewrite).unwrap(), 102);
assert_eq!(memtable.rewrite_count, 25);
assert_eq!(memtable.get(b"kk3"), Some(b"vv33".to_vec()));
assert_eq!(
memtable.global_stats.live_entries(LogQueue::Append),
expected_append
);
assert_eq!(memtable.global_stats.rewrite_entries(), expected_rewrite);
assert_eq!(
memtable.global_stats.deleted_rewrite_entries(),
expected_deleted_rewrite
);
memtable.consistency_check();
// Compact after rewrite.
memtable.append(generate_entry_indexes(
35,
50,
FileId::new(LogQueue::Append, 6),
));
expected_append += 15 - 1;
memtable.compact_to(30);
expected_deleted_rewrite += 20;
assert_eq!(memtable.last_index().unwrap(), 49);
assert_eq!(memtable.rewrite_count, 5);
assert_eq!(
memtable.global_stats.live_entries(LogQueue::Append),
expected_append
);
assert_eq!(memtable.global_stats.rewrite_entries(), expected_rewrite);
assert_eq!(
memtable.global_stats.deleted_rewrite_entries(),
expected_deleted_rewrite
);
memtable.consistency_check();
// Squeeze some.
let ents_idx = generate_entry_indexes(10, 60, FileId::new(LogQueue::Rewrite, 103));
memtable.rewrite(ents_idx, None);
expected_rewrite += 50;
expected_deleted_rewrite += 50;
assert_eq!(memtable.first_index().unwrap(), 30);
assert_eq!(memtable.rewrite_count, 5);
assert_eq!(
memtable.global_stats.live_entries(LogQueue::Append),
expected_append
);
assert_eq!(memtable.global_stats.rewrite_entries(), expected_rewrite);
assert_eq!(
memtable.global_stats.deleted_rewrite_entries(),
expected_deleted_rewrite
);
memtable.consistency_check();
} | rust_cleaned_test_functions.jsonl/18146 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12976,
2005,
74052,
368,
341,
286,
1077,
5537,
842,
284,
220,
23,
280,
286,
1077,
5206,
1833,
2005,
284,
13550,
2556,
486,
931,
48059,
842,
11,
19689,
486,
931,
46744,
16635,
486,
2258,
7392,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extension_with_simple_json_error() {
use colorful_extension::*;
let mock = mock("POST", "/token")
.match_header("Accept", "application/json")
.match_header("Authorization", "Basic YWFhOmJiYg==")
.match_body("grant_type=authorization_code&code=ccc")
.with_status(400)
.with_header("content-type", "application/json")
.with_body(
"{\"error\": \"too_light\", \"error_description\": \"stuff happened\", \
\"error_uri\": \"https://errors\"}")
.create();
let client = ColorfulClient::new(
ClientId::new("aaa".to_string()),
Some(ClientSecret::new("bbb".to_string())),
AuthUrl::new(Url::parse("http://example.com/auth").unwrap()),
Some(TokenUrl::new(
Url::parse(&(SERVER_URL.to_string() + "/token")).unwrap(),
)),
);
let token = client.exchange_code(AuthorizationCode::new("ccc".to_string()));
mock.assert();
assert!(token.is_err());
let token_err = token.err().unwrap();
match &token_err {
&RequestTokenError::ServerResponse(ref error_response) => {
assert_eq!(ColorfulErrorResponseType::TooLight, *error_response.error());
assert_eq!(
Some(&"stuff happened".to_string()),
error_response.error_description()
);
assert_eq!(
Some(&"https://errors".to_string()),
error_response.error_uri()
);
// Ensure that serialization produces an equivalent JSON value.
let serialized_json = serde_json::to_string(&error_response).unwrap();
assert_eq!(
"{\"error\":\"too_light\",\"error_description\":\"stuff happened\",\
\"error_uri\":\"https://errors\"}"
.to_string(),
serialized_json
);
let deserialized_error = serde_json::from_str::<
oauth2::ErrorResponse<ColorfulErrorResponseType>,
>(&serialized_json)
.unwrap();
assert_eq!(error_response, &deserialized_error);
}
other => panic!("Unexpected error: {:?}", other),
}
// Test Debug trait for RequestTokenError
assert_eq!(
"ServerResponse(ErrorResponse { error: too_light, \
error_description: Some(\"stuff happened\"), error_uri: Some(\"https://errors\") })",
format!("{:?}", token_err)
);
// Test Display trait for RequestTokenError
assert_eq!(
"Server returned error response `too_light: stuff happened / See https://errors`",
format!("{}", token_err)
);
} | rust_cleaned_test_functions.jsonl/12783 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31035,
6615,
30015,
9455,
4096,
368,
341,
262,
990,
33866,
31035,
79304,
262,
1077,
7860,
284,
7860,
445,
2946,
497,
3521,
5839,
1138,
286,
659,
6347,
8757,
445,
16646,
497,
330,
5132,
8931,
1138,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_debug() {
assert_eq!(
format!(
"{:?}",
Fp([
0x5360_bb59_7867_8032,
0x7dd2_75ae_799e_128e,
0x5c5b_5071_ce4f_4dcf,
0xcdb2_1f93_078d_bb3e,
0xc323_65c5_e73f_474a,
0x115a_2a54_89ba_be5b,
])
),
"0x104bf052ad3bc99bcb176c24a06a6c3aad4eaf2308fc4d282e106c84a757d061052630515305e59bdddf8111bfdeb704"
);
} | rust_cleaned_test_functions.jsonl/23233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
262,
2060,
10714,
33673,
286,
3561,
33673,
310,
13868,
76475,
24375,
310,
434,
79,
8956,
394,
220,
15,
87,
20,
18,
21,
15,
50255,
20,
24,
62,
22,
23,
21,
22,
62,
23,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_require_of_shebang() {
assert!(matches!(
find_require_of_shebang(Path::new("/usr/bin/ldd")),
Ok(Some(_))
));
assert!(matches!(
find_require_of_shebang(Path::new(file!())),
Ok(None)
));
} | rust_cleaned_test_functions.jsonl/81804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
13793,
3575,
643,
383,
27174,
368,
341,
262,
2060,
10297,
19914,
33673,
286,
1477,
13793,
3575,
643,
383,
27174,
33030,
486,
931,
4283,
7063,
8749,
14,
507,
67,
30154,
286,
7622,
65405,
249... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_timestamps() {
let mut builder = SimpleLogger::new();
assert!(builder.timestamps == true);
builder = builder.with_timestamps(false);
assert!(builder.timestamps == false);
} | rust_cleaned_test_functions.jsonl/79865 | {
"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,
6615,
23073,
82,
368,
341,
286,
1077,
5206,
7363,
284,
8993,
7395,
486,
931,
543,
286,
2060,
10297,
17850,
39668,
621,
830,
626,
286,
7363,
284,
7363,
18164,
23073,
82,
3576,
317,
286,
2060,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_underscore() {
assert_eq!(
use_tree_names("use foo::bar::MyTrait as _;"),
vec![unnamed("use foo::bar::MyTrait as _;"),]
);
} | rust_cleaned_test_functions.jsonl/37350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
53933,
368,
341,
286,
2060,
10714,
33673,
310,
990,
11663,
9187,
445,
810,
15229,
486,
2257,
486,
5050,
49257,
438,
716,
26,
4461,
310,
7486,
20703,
14931,
3606,
445,
810,
15229,
486,
2257,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_partial_sign_mismatched_key() {
let keypair = Keypair::new();
let fee_payer = solana_sdk::pubkey::new_rand();
let ix = Instruction::new_with_bincode(
Pubkey::default(),
&0,
vec![AccountMeta::new(fee_payer, true)],
);
let message = Message::new(&[ix], Some(&fee_payer));
Transaction::new_unsigned(message).partial_sign(&[&keypair], Hash::default());
} | rust_cleaned_test_functions.jsonl/11238 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
11172,
717,
24976,
291,
3097,
368,
341,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
11060,
620,
1135,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_urgent() {
let urgent_types = [
AdminCmdType::Split,
AdminCmdType::BatchSplit,
AdminCmdType::ChangePeer,
AdminCmdType::ChangePeerV2,
AdminCmdType::ComputeHash,
AdminCmdType::VerifyHash,
AdminCmdType::PrepareMerge,
AdminCmdType::CommitMerge,
AdminCmdType::RollbackMerge,
];
for tp in AdminCmdType::values() {
let mut req = RaftCmdRequest::default();
req.mut_admin_request().set_cmd_type(*tp);
assert_eq!(
is_request_urgent(&req),
urgent_types.contains(tp),
"{:?}",
tp
);
}
assert!(!is_request_urgent(&RaftCmdRequest::default()));
} | rust_cleaned_test_functions.jsonl/8299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
85053,
368,
341,
286,
1077,
33671,
9763,
284,
2278,
310,
7582,
15613,
929,
486,
20193,
345,
310,
7582,
15613,
929,
486,
21074,
20193,
345,
310,
7582,
15613,
929,
486,
4072,
30888,
345,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_merge_descriptors() {
let value = vec![
UntaggedValue::row(indexmap! {
"h1".into() => Value::from("Ecuador")
})
.into_untagged_value(),
UntaggedValue::row(indexmap! {
"h2".into() => Value::from("Ecuador")
})
.into_untagged_value(),
UntaggedValue::row(indexmap! {
"h3".into() => Value::from("Ecuador")
})
.into_untagged_value(),
UntaggedValue::row(indexmap! {
"h1".into() => Value::from("Ecuador"),
"h4".into() => Value::from("Ecuador"),
})
.into_untagged_value(),
];
assert_eq!(
merge_descriptors(&value),
vec![
String::from("h1"),
String::from("h2"),
String::from("h3"),
String::from("h4")
]
);
} | rust_cleaned_test_functions.jsonl/124314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 582
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
15768,
25705,
368,
341,
286,
1077,
897,
284,
7486,
90515,
310,
15098,
96476,
1130,
486,
651,
7195,
2186,
0,
341,
394,
330,
71,
16,
3263,
18122,
368,
589,
5162,
486,
1499,
445,
36,
49262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_utf8() {
assert_eq!(Solution::valid_utf8(vec![197, 130, 1]), true);
assert_eq!(Solution::valid_utf8(vec![235, 140, 4]), false);
} | rust_cleaned_test_functions.jsonl/113651 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
39453,
23,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
1891,
39453,
23,
25592,
20703,
16,
24,
22,
11,
220,
16,
18,
15,
11,
220,
16,
9719,
830,
317,
286,
2060,
10714,
10297,
36842,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_snippet_enum() {
#[derive(Debug, Diagnostic, Error)]
#[error("welp")]
#[allow(dead_code)]
enum Foo {
#[diagnostic(code(foo::a))]
A {
src: String,
#[snippet(src, "hi this is where the thing went wrong")]
snip: SourceSpan,
#[highlight(snip)]
var1: SourceSpan,
#[highlight(snip)]
var2: SourceSpan,
filename: String,
second_message: String,
#[snippet(src, filename, second_message)]
snip2: SourceSpan,
},
#[diagnostic(code(foo::b))]
B(
String,
#[snippet(0, "hi")] SourceSpan,
#[highlight(1)] SourceSpan,
#[highlight(1, "var 2")] SourceSpan,
// referenced source name
String,
String,
#[snippet(0, 4, 5)] SourceSpan,
#[highlight(6)] SourceSpan,
#[highlight(6)] SourceSpan,
),
}
} | rust_cleaned_test_functions.jsonl/110954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 589
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28022,
21581,
31054,
368,
341,
262,
11506,
27098,
42618,
11,
49988,
11,
4600,
5563,
262,
11506,
841,
445,
86,
1267,
5422,
262,
11506,
7183,
83207,
4136,
5563,
262,
7618,
33428,
341,
286,
11506,
85... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bootstrapping_constant() {
let params = generate_parameters(SecurityLevel::Bit80);
let (secret_key, cloud_key) = generate_keys(¶ms);
let every_combo = vec![true, false];
for x in every_combo {
let bootstrapped = boots_constant(x, &cloud_key);
let decrypted = decrypt(&bootstrapped, &secret_key);
assert_eq!(x, decrypted);
}
} | rust_cleaned_test_functions.jsonl/69337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52062,
495,
3629,
34967,
368,
341,
220,
1077,
3628,
284,
6923,
18263,
3759,
18429,
4449,
486,
8344,
23,
15,
317,
220,
1077,
320,
20474,
3097,
11,
9437,
3097,
8,
284,
6923,
12631,
2099,
3519,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_validate_transaction() {
let (config, key) = config_builder::test_config();
let (vm_validator, mut rt) = TestValidator::new(&config);
let address = account_config::association_address();
let program = encode_transfer_script(&address, vec![], 100);
let transaction = transaction_test_helpers::get_test_signed_txn(
address,
1,
&key,
key.public_key(),
Some(program),
);
let ret = rt
.block_on(vm_validator.validate_transaction(transaction))
.unwrap();
assert_eq!(ret, None);
} | rust_cleaned_test_functions.jsonl/2294 | {
"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,
42681,
28884,
368,
341,
262,
1077,
320,
1676,
11,
1376,
8,
284,
2193,
28532,
486,
1944,
5332,
543,
262,
1077,
320,
7338,
64959,
11,
5206,
16677,
8,
284,
3393,
14256,
486,
931,
2099,
1676,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_igmp_integration_fallback_from_idle() {
let mut ctx = setup_simple_test_environment();
igmp_join_group(&mut ctx, DummyDeviceId, MulticastAddr::new(GROUP_ADDR).unwrap());
assert_eq!(ctx.frames().len(), 1);
assert!(ctx.trigger_next_timer::<IgmpTimerHandler>());
assert_eq!(ctx.frames().len(), 2);
receive_igmp_query(&mut ctx, DummyDeviceId, Duration::from_secs(10));
let group_state = <DummyContext as StateContext<IgmpInterface<_>, _>>::get_state_with(
&ctx,
DummyDeviceId,
)
.groups
.get(&MulticastAddr::new(GROUP_ADDR).unwrap())
.unwrap();
match group_state.get_inner() {
MemberState::Delaying(_) => {}
_ => panic!("Wrong State!"),
}
assert!(ctx.trigger_next_timer::<IgmpTimerHandler>());
assert_eq!(ctx.frames().len(), 3);
ensure_ttl_ihl_rtr(&ctx);
} | rust_cleaned_test_functions.jsonl/30902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
343,
1307,
90250,
761,
3420,
5673,
47810,
368,
341,
286,
1077,
5206,
5635,
284,
6505,
30015,
4452,
51774,
543,
286,
19373,
1307,
31017,
6288,
2099,
6984,
5635,
11,
50567,
6985,
764,
11,
22162,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_append_refcnt() {
let gil = Python::acquire_gil();
let py = gil.python();
let cnt;
{
let _pool = unsafe { crate::GILPool::new() };
let list = PyList::empty(py);
let none = py.None();
cnt = none.get_refcnt(py);
list.append(none).unwrap();
}
assert_eq!(cnt, py.None().get_refcnt(py));
} | rust_cleaned_test_functions.jsonl/100382 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
7793,
15853,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
1428,
286,
1077,
13195,
280,
286,
341,
310,
1077,
716,
10285,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_method_conversions() {
assert_eq!(HttpMethod::DELETE, Method::Delete.into_http());
assert_eq!(HttpMethod::GET, Method::Get.into_http());
assert_eq!(HttpMethod::PATCH, Method::Patch.into_http());
assert_eq!(HttpMethod::POST, Method::Post.into_http());
assert_eq!(HttpMethod::PUT, Method::Put.into_http());
} | rust_cleaned_test_functions.jsonl/13623 | {
"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,
9032,
3382,
28290,
368,
341,
286,
2060,
10714,
10297,
2905,
3523,
486,
14424,
11,
6730,
486,
6435,
39860,
25888,
1423,
286,
2060,
10714,
10297,
2905,
3523,
486,
3806,
11,
6730,
486,
1949,
39860,
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_initialize_with_disallowed_process() {
let process = Process::new(1).expect("Failed to initialize process");
let version = get_ruby_version(&process);
match version
.unwrap_err()
.root_cause()
.downcast_ref::<AddressFinderError>()
.unwrap()
{
&AddressFinderError::PermissionDenied(1) => {}
_ => assert!(false, "Expected PermissionDenied error"),
}
} | rust_cleaned_test_functions.jsonl/90831 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40889,
6615,
9932,
20967,
11305,
368,
341,
286,
1077,
1882,
284,
8603,
486,
931,
7,
16,
568,
17119,
445,
9408,
311,
9468,
1882,
797,
286,
1077,
2319,
284,
633,
1710,
20028,
9438,
2099,
4630,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_zinc_parse_utf8_str() {
let mut input = Cursor::new("\"m³_gas\"".as_bytes());
let mut scanner = super::Scanner::make(&mut input).expect("Scanner");
let str = parse_str(&mut scanner);
assert_eq!(str.ok(), Some(Str::make("m³_gas")));
} | rust_cleaned_test_functions.jsonl/80277 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6415,
2840,
21039,
39453,
23,
2895,
368,
341,
286,
1077,
5206,
1946,
284,
28067,
486,
931,
38915,
76,
43201,
82116,
2105,
3263,
300,
12524,
1423,
286,
1077,
5206,
20775,
284,
2256,
486,
31002,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_kernel_invalid_entry() {
// program header has to be past the end of the elf header
let gm = create_guest_mem();
let bad_image = make_test_bin();
assert_eq!(
Err(Error::InvalidEntryAddress),
load_kernel(&gm, &mut Cursor::new(&bad_image), std::u64::MAX)
);
} | rust_cleaned_test_functions.jsonl/88250 | {
"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,
34199,
26876,
31433,
9078,
368,
341,
286,
442,
2025,
4247,
702,
311,
387,
3267,
279,
835,
315,
279,
40745,
4247,
198,
286,
1077,
37879,
284,
1855,
62739,
12976,
543,
286,
1077,
3873,
4954,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ptrace_getevent() {
require_capability!("test_ptrace_getevent", CAP_SYS_PTRACE);
let err = ptrace::getevent(getpid()).unwrap_err();
assert!(err != Errno::EOPNOTSUPP);
} | rust_cleaned_test_functions.jsonl/33735 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4348,
578,
3062,
3087,
368,
341,
262,
1373,
89686,
17223,
1944,
4348,
578,
3062,
3087,
497,
26101,
26783,
20657,
5576,
317,
262,
1077,
1848,
284,
10087,
578,
486,
455,
3087,
5433,
10412,
6011,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_hard_link() {
let dir = TempDir::new("base").unwrap();
let src = dir.path().join("src.txt");
let dst = dir.path().join("dst.txt");
{
let mut file = fs::File::create(&src).unwrap();
file.write_all(b"hello").unwrap();
}
pool::run({ hard_link(src, dst.clone()) });
let mut content = String::new();
{
let file = fs::File::open(dst).unwrap();
let mut reader = BufReader::new(file);
reader.read_to_string(&mut content).unwrap();
}
assert!(content == "hello");
} | rust_cleaned_test_functions.jsonl/44600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77712,
7233,
368,
341,
262,
1077,
5419,
284,
19944,
6184,
486,
931,
445,
3152,
1827,
15454,
543,
262,
1077,
2286,
284,
5419,
3875,
1005,
5987,
445,
3548,
3909,
797,
262,
1077,
10648,
284,
5419,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_store_fail_account0_not_signer() {
solana_logger::setup();
let (bank, mint_keypair) = create_bank(10_000);
let system_keypair = Keypair::new();
let system_pubkey = system_keypair.pubkey();
bank.transfer(42, &mint_keypair, &system_pubkey).unwrap();
let (bank_client, config_keypair) = create_config_account(bank, &mint_keypair);
let config_pubkey = config_keypair.pubkey();
let transfer_instruction =
system_instruction::transfer(&system_pubkey, &Pubkey::new_rand(), 42);
let my_config = MyConfig::new(42);
let mut store_instruction = config_instruction::store(&config_pubkey, &my_config);
store_instruction.accounts[0].is_signer = false; // <----- not a signer
let message = Message::new(vec![transfer_instruction, store_instruction]);
bank_client
.send_message(&[&system_keypair], message)
.unwrap_err();
} | rust_cleaned_test_functions.jsonl/23616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14809,
22121,
13500,
15,
7913,
11172,
261,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
320,
17033,
11,
28337,
3097,
12670,
8,
284,
1855,
35733,
7,
16,
15,
62,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_210() {
assert_eq!(Solution::find_order(2, vec![vec![1, 0]]), vec![0, 1]);
assert_eq!(
Solution::find_order(4, vec![vec![1, 0], vec![2, 0], vec![3, 1], vec![3, 2]]),
vec![0, 1, 2, 3]
);
} | rust_cleaned_test_functions.jsonl/46167 | {
"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,
62,
17,
16,
15,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
3903,
7869,
7,
17,
11,
7486,
20703,
4083,
20703,
16,
11,
220,
15,
5053,
701,
7486,
20703,
15,
11,
220,
16,
2558,
286,
2060,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_reader_rows_nulls_typed() {
type RowTyped = (Option<(Option<i32>,)>,);
let rows = test_file_reader_rows::<RowTyped>("nulls.snappy.parquet", None).unwrap();
let expected_rows: Vec<RowTyped> = vec![
(Some((None,)),),
(Some((None,)),),
(Some((None,)),),
(Some((None,)),),
(Some((None,)),),
(Some((None,)),),
(Some((None,)),),
(Some((None,)),),
];
assert_eq!(rows, expected_rows);
} | rust_cleaned_test_functions.jsonl/92458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
22306,
10949,
15162,
82,
528,
32501,
368,
341,
197,
13158,
10801,
44466,
284,
320,
5341,
28706,
5341,
21897,
18,
17,
8066,
8,
8066,
626,
197,
10217,
6978,
284,
1273,
2458,
22306,
10949,
2763... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assume_next_day() {
let now = Utc
.datetime_from_str("2020-07-12T12:45:00", "%Y-%m-%dT%H:%M:%S")
.unwrap(); // sunday
let expected = Utc
.datetime_from_str("2020-07-12T08:00:00", "%Y-%m-%dT%H:%M:%S")
.unwrap();
assert_eq!(
evaluate_time_clue(TimeClue::Time((8, 0, 0), None), now.clone(), false).unwrap(),
expected
);
let expected = Utc
.datetime_from_str("2020-07-13T08:00:00", "%Y-%m-%dT%H:%M:%S")
.unwrap();
assert_eq!(
evaluate_time_clue(TimeClue::Time((8, 0, 0), None), now, true).unwrap(),
expected
);
} | rust_cleaned_test_functions.jsonl/79603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12083,
3885,
11257,
16763,
368,
341,
286,
1077,
1431,
284,
547,
10413,
198,
310,
659,
15450,
5673,
2895,
445,
17,
15,
17,
15,
12,
15,
22,
12,
16,
17,
51,
16,
17,
25,
19,
20,
25,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_PoK_VC_OtherGroup() {
let n = 5;
test_PoK_VC!(
n,
ProverCommittingOtherGroup,
ProverCommittedOtherGroup,
ProofOtherGroup,
OtherGroup,
OtherGroupVec
);
} | rust_cleaned_test_functions.jsonl/62466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1088,
78,
42,
84252,
2232,
696,
2808,
368,
341,
286,
1077,
308,
284,
220,
20,
401,
286,
1273,
1088,
78,
42,
84252,
33673,
310,
308,
345,
310,
1298,
423,
33441,
1280,
11409,
2808,
345,
310,
129... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dump_items_serialize_json() {
let result_a = DumpItems::default();
let res = result_a.to_json();
assert!(res.is_ok());
let json = res.unwrap();
let res = DumpItems::from_json(&json);
assert!(res.is_ok());
let result_b = res.unwrap();
assert_eq!(result_a, result_b);
} | rust_cleaned_test_functions.jsonl/126649 | {
"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,
18296,
12134,
88686,
9455,
368,
341,
262,
1077,
1102,
4306,
284,
29693,
4353,
486,
2258,
543,
1066,
262,
1077,
592,
284,
1102,
4306,
2389,
9455,
543,
262,
2060,
10297,
416,
2079,
19817,
1423,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_hashing() {
let example_content = "this is an example";
let expected_sum =
hex_decode("9202816dabaaf34bb106a10421b9a0d0").unwrap();
let file = tempfile::NamedTempFile::new().unwrap();
write!(&file, "{}", example_content).unwrap();
let actual_sum = md5_file(&file.path().to_path_buf()).unwrap();
assert_eq!(expected_sum, actual_sum);
} | rust_cleaned_test_functions.jsonl/73298 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
8950,
287,
368,
341,
286,
1077,
3110,
7495,
284,
330,
574,
374,
458,
3110,
876,
286,
1077,
3601,
10160,
4035,
310,
12371,
15227,
445,
24,
17,
15,
17,
23,
16,
21,
67,
12004,
2577,
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... | 1 |
#[test]
fn test_gen_range_panic_usize() {
#![allow(clippy::reversed_empty_ranges)]
let mut r = rng(103);
r.gen_range(5..2);
} | rust_cleaned_test_functions.jsonl/10500 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
9698,
620,
31270,
11306,
551,
368,
341,
286,
671,
20703,
7183,
9849,
45749,
486,
265,
43776,
15124,
58748,
5563,
286,
1077,
5206,
435,
284,
28422,
7,
16,
15,
18,
317,
286,
435,
22822,
969... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_hover_no_links() {
check_hover_no_links(
r#"
/// Test cases:
/// case 1. bare URL: https://www.example.com/
/// case 2. inline URL with title: [example](https://www.example.com/)
/// case 3. code reference: [`Result`]
/// case 4. code reference but miss footnote: [`String`]
/// case 5. autolink: <http://www.example.com/>
/// case 6. email address: <test@example.com>
/// case 7. reference: [example][example]
/// case 8. collapsed link: [example][]
/// case 9. shortcut link: [example]
/// case 10. inline without URL: [example]()
/// case 11. reference: [foo][foo]
/// case 12. reference: [foo][bar]
/// case 13. collapsed link: [foo][]
/// case 14. shortcut link: [foo]
/// case 15. inline without URL: [foo]()
/// case 16. just escaped text: \[foo]
/// case 17. inline link: [Foo](foo::Foo)
///
/// [`Result`]: ../../std/result/enum.Result.html
/// [^example]: https://www.example.com/
pub fn fo$0o() {}
"#,
expect
case 3. code reference: `Result`
case 4. code reference but miss footnote: `String`
case 5. autolink: http://www.example.com/
case 6. email address: test@example.com
case 7. reference: example
case 8. collapsed link: example
case 9. shortcut link: example
case 10. inline without URL: example
case 11. reference: foo
case 12. reference: foo
case 13. collapsed link: foo
case 14. shortcut link: foo
case 15. inline without URL: foo
case 16. just escaped text: \[foo\]
case 17. inline link: Foo
[^example]: https://www.example.com/
"#]],
);
} | rust_cleaned_test_functions.jsonl/66660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1034
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
6536,
25258,
368,
341,
286,
1779,
53445,
6536,
25258,
1006,
310,
435,
2,
698,
2575,
3393,
5048,
510,
2575,
1142,
220,
16,
13,
220,
12461,
5548,
25,
3703,
1110,
2136,
7724,
905,
5894,
2575... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_addition() {
let left = Pair::from("[[[[4,3],4],4],[7,[[8,4],9]]]".as_bytes());
let right = Pair::from("[1,1]".as_bytes());
let sum = Pair::from("[[[[0,7],4],[[7,8],[6,0]]],[8,1]]".as_bytes());
assert_eq!(left + right, sum);
} | rust_cleaned_test_functions.jsonl/31386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
680,
368,
341,
286,
1077,
2115,
284,
25995,
486,
1499,
10937,
15505,
58,
19,
11,
18,
1125,
19,
1125,
19,
14955,
22,
11,
15505,
23,
11,
19,
1125,
24,
5053,
60,
3263,
300,
12524,
1423,
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_runlevel() {
for opt in vec!["-r", "--runlevel"] {
#[cfg(any(target_vendor = "apple", target_os = "linux"))]
new_ucmd!()
.arg(opt)
.succeeds()
.stdout_is(expected_result(&[opt]));
#[cfg(not(target_os = "linux"))]
new_ucmd!().arg(opt).succeeds().stdout_is("");
}
} | rust_cleaned_test_functions.jsonl/79395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
3294,
368,
341,
262,
369,
3387,
304,
7486,
0,
1183,
12,
81,
497,
14482,
6108,
3294,
1341,
341,
286,
11506,
14072,
40268,
8637,
58320,
284,
330,
22377,
497,
2169,
29387,
284,
330,
14210,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_expire_lru() {
let mut cache: LruCache<String, String> = LruCache::new(2);
cache.put("foo1".to_string(), "bar1".to_string());
cache.put("foo2".to_string(), "bar2".to_string());
cache.put("foo3".to_string(), "bar3".to_string());
assert!(cache.get(&"foo1".to_string()).is_none());
cache.put("foo2".to_string(), "bar2update".to_string());
cache.put("foo4".to_string(), "bar4".to_string());
assert!(cache.get(&"foo3".to_string()).is_none());
} | rust_cleaned_test_functions.jsonl/30780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83409,
907,
2672,
368,
341,
286,
1077,
5206,
6500,
25,
444,
2672,
8233,
3464,
11,
923,
29,
284,
444,
2672,
8233,
486,
931,
7,
17,
317,
286,
6500,
3597,
445,
7975,
16,
3263,
983,
3904,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_voice_state_update() {
let update = VoiceStateUpdate(VoiceState {
channel_id: None,
deaf: false,
guild_id: Some(GuildId(1)),
member: Some(Member {
deaf: false,
guild_id: GuildId(1),
hoisted_role: Some(RoleId(4)),
joined_at: None,
mute: false,
nick: None,
premium_since: None,
roles: vec![RoleId(4)],
user: User {
id: UserId(1),
avatar: None,
bot: false,
discriminator: "0909".to_string(),
name: "foo".to_string(),
mfa_enabled: None,
locale: None,
verified: None,
email: None,
flags: None,
premium_type: None,
system: None,
public_flags: None,
},
}),
mute: false,
self_deaf: false,
self_mute: false,
self_stream: false,
session_id: "a".to_owned(),
suppress: false,
token: None,
user_id: UserId(1),
});
serde_test::assert_tokens(
&update,
&[
Token::NewtypeStruct {
name: "VoiceStateUpdate",
},
Token::Struct {
name: "VoiceState",
len: 12,
},
Token::Str("channel_id"),
Token::None,
Token::Str("deaf"),
Token::Bool(false),
Token::Str("guild_id"),
Token::Some,
Token::NewtypeStruct { name: "GuildId" },
Token::Str("1"),
Token::Str("member"),
Token::Some,
Token::Struct {
name: "Member",
len: 9,
},
Token::Str("deaf"),
Token::Bool(false),
Token::Str("guild_id"),
Token::NewtypeStruct { name: "GuildId" },
Token::Str("1"),
Token::Str("hoisted_role"),
Token::Some,
Token::NewtypeStruct { name: "RoleId" },
Token::Str("4"),
Token::Str("joined_at"),
Token::None,
Token::Str("mute"),
Token::Bool(false),
Token::Str("nick"),
Token::None,
Token::Str("premium_since"),
Token::None,
Token::Str("roles"),
Token::Seq { len: Some(1) },
Token::NewtypeStruct { name: "RoleId" },
Token::Str("4"),
Token::SeqEnd,
Token::Str("user"),
Token::Struct {
name: "User",
len: 13,
},
Token::Str("avatar"),
Token::None,
Token::Str("bot"),
Token::Bool(false),
Token::Str("discriminator"),
Token::Str("0909"),
Token::Str("email"),
Token::None,
Token::Str("flags"),
Token::None,
Token::Str("id"),
Token::NewtypeStruct { name: "UserId" },
Token::Str("1"),
Token::Str("locale"),
Token::None,
Token::Str("mfa_enabled"),
Token::None,
Token::Str("username"),
Token::Str("foo"),
Token::Str("premium_type"),
Token::None,
Token::Str("public_flags"),
Token::None,
Token::Str("system"),
Token::None,
Token::Str("verified"),
Token::None,
Token::StructEnd,
Token::StructEnd,
Token::Str("mute"),
Token::Bool(false),
Token::Str("self_deaf"),
Token::Bool(false),
Token::Str("self_mute"),
Token::Bool(false),
Token::Str("self_stream"),
Token::Bool(false),
Token::Str("session_id"),
Token::Str("a"),
Token::Str("suppress"),
Token::Bool(false),
Token::Str("token"),
Token::None,
Token::Str("user_id"),
Token::NewtypeStruct { name: "UserId" },
Token::Str("1"),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/89969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3070
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76765,
4387,
8882,
368,
341,
286,
1077,
2647,
284,
27930,
1397,
4289,
12410,
8834,
1397,
341,
310,
5496,
842,
25,
2240,
345,
310,
46742,
25,
895,
345,
310,
26411,
842,
25,
4329,
6699,
1498,
764,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tiny() {
assert_eq!(Tiny::new(vec![]), None);
test_vec(vec![1]);
test_vec(vec![1024]);
test_vec(vec![1,2]);
test_vec(vec![1,2,3]);
test_vec(vec![1,2,3,4,5]);
test_vec(vec![1,2,3,4,5,6]);
} | rust_cleaned_test_functions.jsonl/14586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
6441,
368,
341,
262,
2060,
10714,
10297,
85693,
486,
931,
25592,
0,
1294,
701,
2240,
317,
262,
1273,
13251,
25592,
20703,
16,
2558,
262,
1273,
13251,
25592,
20703,
16,
15,
17,
19,
2558,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.