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_expose_keys_on_insecure_backend() {
let _guard = LOCK_FOR_GAUGE.lock().unwrap();
let (key_path, _tmp_key_dir) = create_key_file("key");
let file_backend = FileBackend::new(key_path.as_path()).unwrap();
let master_key_backend = Box::new(file_backend);
let tmp_dir = tempfile::TempDir::new().unwrap();
let previous = new_mock_backend() as Box<dyn Backend>;
let manager = new_key_manager(&tmp_dir, None, master_key_backend, previous).unwrap();
let file_backend = FileBackend::new(key_path.as_path()).unwrap();
let master_key_backend = Box::new(file_backend);
for i in 0..100 {
manager
.dicts
.rotate_key(i, DataKey::default(), &*master_key_backend)
.unwrap();
}
for value in manager.dicts.key_dict.lock().unwrap().keys.values() {
assert!(!value.was_exposed);
}
// must set expose for all keys.
let insecure = PlaintextBackend::default();
manager
.dicts
.rotate_key(100, DataKey::default(), &insecure)
.unwrap();
let mut count = 0;
for value in manager.dicts.key_dict.lock().unwrap().keys.values() {
count += 1;
assert!(value.was_exposed);
}
assert!(count >= 101);
} | rust_cleaned_test_functions.jsonl/22023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 683
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
2900,
12631,
4470,
1243,
25132,
40011,
368,
341,
286,
1077,
716,
26098,
284,
49463,
14516,
2646,
32,
47644,
21003,
1005,
15454,
543,
286,
1077,
320,
792,
2638,
11,
716,
5173,
3097,
4334,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_should_retransmit_and_persist() {
let me_id = Pubkey::new_rand();
let leader_keypair = Arc::new(Keypair::new());
let leader_pubkey = leader_keypair.pubkey();
let bank = Arc::new(Bank::new(
&create_genesis_block_with_leader(100, &leader_pubkey, 10).genesis_block,
));
let cache = Arc::new(LeaderScheduleCache::new_from_bank(&bank));
let mut shreds = local_entries_to_shred(&[Entry::default()], 0, 0, &leader_keypair);
assert_eq!(
should_retransmit_and_persist(&shreds[0], Some(bank.clone()), &cache, &me_id, 0,),
true
);
let (common, coding) = Shredder::new_coding_shred_header(5, 5, 6, 6, 0);
let mut coding_shred =
Shred::new_empty_from_header(common, DataShredHeader::default(), coding);
Shredder::sign_shred(&leader_keypair, &mut coding_shred);
assert_eq!(
should_retransmit_and_persist(&coding_shred, Some(bank.clone()), &cache, &me_id, 0),
true
);
assert_eq!(
should_retransmit_and_persist(&coding_shred, Some(bank.clone()), &cache, &me_id, 5),
true
);
assert_eq!(
should_retransmit_and_persist(&coding_shred, Some(bank.clone()), &cache, &me_id, 6),
false
);
shreds[0].set_slot(MINIMUM_SLOTS_PER_EPOCH as u64 * 3);
assert_eq!(
should_retransmit_and_persist(&shreds[0], Some(bank.clone()), &cache, &me_id, 0),
false
);
let slot = MINIMUM_SLOTS_PER_EPOCH as u64 * 3;
let shreds = local_entries_to_shred(&[Entry::default()], slot, slot - 1, &leader_keypair);
assert_eq!(
should_retransmit_and_persist(&shreds[0], Some(bank.clone()), &cache, &me_id, slot),
false
);
let slot = MINIMUM_SLOTS_PER_EPOCH as u64 * 3;
let shreds =
local_entries_to_shred(&[Entry::default()], slot + 1, slot - 1, &leader_keypair);
assert_eq!(
should_retransmit_and_persist(&shreds[0], Some(bank.clone()), &cache, &me_id, slot),
false
);
assert_eq!(
should_retransmit_and_persist(&shreds[0], None, &cache, &me_id, 0),
false
);
} | rust_cleaned_test_functions.jsonl/16021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
1288,
1458,
1763,
8378,
620,
4975,
368,
341,
286,
1077,
752,
842,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
7653,
3097,
12670,
284,
19689,
486,
931,
7,
6608,
1082,
1310,
486,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_max_columns_check() {
let mut vec = vec![];
let mut node = Expr::new();
node.set_tp(ExprType::ColumnRef);
node.mut_val().encode_i64(0).unwrap();
assert!(
append_rpn_nodes_recursively(node.clone(), &mut vec, &Tz::utc(), fn_mapper, 0).is_err()
);
for i in 1..10 {
assert!(
append_rpn_nodes_recursively(node.clone(), &mut vec, &Tz::utc(), fn_mapper, i)
.is_ok()
);
}
let mut node = Expr::new();
node.set_tp(ExprType::ColumnRef);
node.mut_val().encode_i64(3).unwrap();
for i in 0..=3 {
assert!(
append_rpn_nodes_recursively(node.clone(), &mut vec, &Tz::utc(), fn_mapper, i)
.is_err()
);
}
for i in 4..10 {
assert!(
append_rpn_nodes_recursively(node.clone(), &mut vec, &Tz::utc(), fn_mapper, i)
.is_ok()
);
}
let mut node = Expr::new();
node.set_tp(ExprType::ScalarFunc);
node.set_sig(ScalarFuncSig::CastIntAsString); // FnC
node.mut_field_type()
.as_mut_accessor()
.set_tp(FieldTypeTp::LongLong);
node.mut_children().push({
let mut n = Expr::new();
n.set_tp(ExprType::ColumnRef);
n.mut_val().encode_i64(1).unwrap();
n
});
node.mut_children().push({
let mut n = Expr::new();
n.set_tp(ExprType::ColumnRef);
n.mut_val().encode_i64(2).unwrap();
n
});
node.mut_children().push({
let mut n = Expr::new();
n.set_tp(ExprType::ColumnRef);
n.mut_val().encode_i64(5).unwrap();
n
});
for i in 0..=5 {
assert!(
append_rpn_nodes_recursively(node.clone(), &mut vec, &Tz::utc(), fn_mapper, i)
.is_err()
);
}
for i in 6..10 {
assert!(
append_rpn_nodes_recursively(node.clone(), &mut vec, &Tz::utc(), fn_mapper, i)
.is_ok()
);
}
} | rust_cleaned_test_functions.jsonl/14487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
22590,
7200,
368,
341,
286,
1077,
5206,
7486,
284,
7486,
0,
40901,
1789,
286,
1077,
5206,
2436,
284,
28819,
486,
931,
543,
286,
2436,
980,
55191,
7,
16041,
929,
486,
2933,
3945,
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... | 6 |
#[test]
fn test_high_priority_get_put() {
let storage = TestStorageBuilder::new().build().unwrap();
let (tx, rx) = channel();
let mut ctx = Context::new();
ctx.set_priority(CommandPri::High);
expect_none(storage.async_get(ctx, Key::from_raw(b"x"), 100).wait());
let mut ctx = Context::new();
ctx.set_priority(CommandPri::High);
storage
.async_prewrite(
ctx,
vec![Mutation::Put((Key::from_raw(b"x"), b"100".to_vec()))],
b"x".to_vec(),
100,
Options::default(),
expect_ok_callback(tx.clone(), 1),
)
.unwrap();
rx.recv().unwrap();
let mut ctx = Context::new();
ctx.set_priority(CommandPri::High);
storage
.async_commit(
ctx,
vec![Key::from_raw(b"x")],
100,
101,
expect_ok_callback(tx.clone(), 2),
)
.unwrap();
rx.recv().unwrap();
let mut ctx = Context::new();
ctx.set_priority(CommandPri::High);
expect_none(storage.async_get(ctx, Key::from_raw(b"x"), 100).wait());
let mut ctx = Context::new();
ctx.set_priority(CommandPri::High);
expect_value(
b"100".to_vec(),
storage.async_get(ctx, Key::from_raw(b"x"), 101).wait(),
);
} | rust_cleaned_test_functions.jsonl/22312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 813
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22680,
38161,
3062,
15557,
368,
341,
286,
1077,
5819,
284,
3393,
5793,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
320,
3998,
11,
19111,
8,
284,
5496,
543,
286,
1077,
5206,
5635,
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_struct_1() {
let src_data = b"(test) struct {}";
let expected_document = yass_document!(("test") "struct": {});
let expected_positions = pos_array![(0, 7), (0, 14)];
let (result_doc, pos_map) = yass_parser::parse(yass_parser::ParserLimits::unlimited(), src_data).unwrap();
assert_eq!(result_doc, expected_document);
assert_eq!(result_doc.gather_positions_to_vec(&pos_map), expected_positions);
} | rust_cleaned_test_functions.jsonl/126486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
62,
16,
368,
341,
262,
1077,
2286,
1769,
284,
293,
29209,
1944,
8,
2036,
4687,
876,
262,
1077,
3601,
26231,
284,
379,
395,
26231,
10297,
445,
1944,
899,
330,
1235,
788,
35311,
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_loc_macro() {
let a = locof!(pos(1, 2), pos(3, 4));
let b = locof!([1, 2], [3, 4]);
let c = locof!(1, 2, 3, 4);
let d = locof!((1, 2)..(3, 4));
assert_eq!(a, b);
assert_eq!(b, c);
assert_eq!(c, d);
} | rust_cleaned_test_functions.jsonl/20817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13400,
58810,
368,
341,
262,
1077,
264,
284,
1329,
1055,
10297,
966,
7,
16,
11,
220,
17,
701,
1133,
7,
18,
11,
220,
19,
1106,
262,
1077,
293,
284,
1329,
1055,
0,
2561,
16,
11,
220,
17,
112... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_url_queries() {
let base_url = Url::parse(API_ENDPOINT_BASE).unwrap();
let url = UrlBuilder::new(&base_url, USER_ID)
.tweet_fields(vec!["a", "b", "c"])
.max_results(100);
assert_eq!(
"tweet.fields=a%2Cb%2Cc&max_results=100",
url.0.query().unwrap()
);
} | rust_cleaned_test_functions.jsonl/112162 | {
"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,
2903,
65588,
368,
341,
286,
1077,
2331,
2903,
284,
22840,
486,
6400,
48953,
48756,
11762,
568,
15454,
543,
286,
1077,
2515,
284,
22840,
3297,
486,
931,
2099,
3152,
2903,
11,
13872,
3450,
340,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_offset_operand_invalid() {
parse_offset_operand_str("").unwrap_err();
parse_offset_operand_str("a").unwrap_err();
parse_offset_operand_str("+").unwrap_err();
parse_offset_operand_str("+b").unwrap_err();
parse_offset_operand_str("0x1.").unwrap_err();
parse_offset_operand_str("0x1.b").unwrap_err();
parse_offset_operand_str("-").unwrap_err();
parse_offset_operand_str("-1").unwrap_err();
parse_offset_operand_str("1e10").unwrap_err();
} | rust_cleaned_test_functions.jsonl/58009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6917,
69259,
31433,
368,
341,
286,
4715,
6917,
69259,
2895,
80821,
15454,
9266,
543,
286,
4715,
6917,
69259,
2895,
445,
64,
1827,
15454,
9266,
543,
286,
4715,
6917,
69259,
2895,
34973,
1827,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_number_of_outputs() {
let (orig_tx, _ledger) = create_test_tx();
let max_outputs = 25;
for num_outputs in 0..100 {
let mut tx_prefix = orig_tx.prefix.clone();
tx_prefix.outputs.clear();
for _i in 0..num_outputs {
tx_prefix.outputs.push(orig_tx.prefix.outputs[0].clone());
}
let expected_result = if num_outputs == 0 {
Err(TransactionValidationError::NoOutputs)
} else if num_outputs > max_outputs {
Err(TransactionValidationError::TooManyOutputs)
} else {
Ok(())
};
assert_eq!(
validate_number_of_outputs(&tx_prefix, max_outputs),
expected_result,
);
}
} | rust_cleaned_test_functions.jsonl/33273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
5500,
3575,
35189,
368,
341,
286,
1077,
320,
4670,
17805,
11,
716,
50704,
8,
284,
1855,
4452,
17805,
543,
286,
1077,
1932,
35189,
284,
220,
17,
20,
401,
286,
369,
1629,
35189,
304,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_raw_write_ttl_not_enabled() {
let mut meta = SstMeta::default();
meta.set_uuid(Uuid::new_v4().as_bytes().to_vec());
let importer_dir = tempfile::tempdir().unwrap();
let cfg = Config::default();
let importer = SSTImporter::new(&cfg, &importer_dir, None, ApiVersion::V1).unwrap();
let db_path = importer_dir.path().join("db");
let db = new_test_engine(db_path.to_str().unwrap(), DATA_CFS);
let mut w = importer.new_raw_writer::<TestEngine>(&db, meta).unwrap();
let mut batch = RawWriteBatch::default();
batch.set_ttl(10);
assert!(w.write(batch).is_err());
} | rust_cleaned_test_functions.jsonl/33216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
9165,
87157,
7913,
18220,
368,
341,
286,
1077,
5206,
8823,
284,
328,
267,
12175,
486,
2258,
543,
286,
8823,
980,
25540,
12317,
2423,
486,
931,
2273,
19,
1005,
300,
12524,
1005,
983,
13251,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_literal_generic_struct() {
check(
r#"
struct A<T> { a: T }
fn foo() {
let _: A<u32> = A { $0 }
}
"#,
expect![[r#"
fd a u32
"#]],
);
} | rust_cleaned_test_functions.jsonl/39750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
34100,
41232,
15126,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
362,
3125,
29,
314,
264,
25,
350,
555,
8822,
15229,
368,
341,
256,
1077,
58536,
362,
34837,
18,
17,
29,
284,
362,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_Elf_from_rel_hdr_mut() {
let mut buf = ELF32_REL_ELF_HDR.clone();
let elf: Result<Elf<'_, LittleEndian, Elf32>, ElfError> =
Elf::try_from(&mut buf[0..]);
assert!(elf.is_ok());
} | rust_cleaned_test_functions.jsonl/119486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2089,
11008,
5673,
13557,
28238,
29523,
368,
341,
262,
1077,
5206,
6607,
284,
72568,
18,
17,
41207,
2089,
22609,
55765,
15997,
543,
262,
1077,
40745,
25,
5714,
27,
75832,
18291,
6878,
14671,
43231,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rule_bpf_output() {
assert!(Cond::new(6, ArgLen::QWORD, Eq, 1).is_err());
// Builds rule.
let rule = SeccompRule::new(
vec![
Cond::new(0, ArgLen::DWORD, Eq, 1).unwrap(),
Cond::new(2, ArgLen::QWORD, MaskedEq(0b1010), 14).unwrap(),
],
SeccompAction::Allow,
);
// Calculates architecture dependent argument value offsets.
let (msb_offset, lsb_offset) = {
#[cfg(target_endian = "big")]
{
(0, 4)
}
#[cfg(target_endian = "little")]
{
(4, 0)
}
};
// Builds hardcoded BPF instructions.
let instructions = vec![
BPF_STMT(0x05, 1),
BPF_STMT(0x05, 10),
BPF_STMT(0x20, 32 + msb_offset),
BPF_STMT(0x54, 0),
BPF_JUMP(0x15, 0, 0, 6),
BPF_STMT(0x20, 32 + lsb_offset),
BPF_STMT(0x54, 0b1010),
BPF_JUMP(0x15, 14 & 0b1010, 0, 3),
BPF_STMT(0x20, 16 + lsb_offset),
BPF_JUMP(0x15, 1, 0, 1),
BPF_STMT(0x06, 0x7fff_0000),
];
// Compares translated rule with hardcoded BPF instructions.
assert_eq!(rule.into_bpf(), instructions);
} | rust_cleaned_test_functions.jsonl/17475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 805
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21124,
880,
15897,
7645,
368,
341,
286,
2060,
10297,
49696,
486,
931,
7,
21,
11,
7638,
11271,
486,
48,
7227,
11,
33122,
11,
220,
16,
568,
285,
9266,
5231,
286,
442,
67118,
5912,
624,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_perms() {
let tempdir = Builder::new().prefix("ssh-key-dir").tempdir().unwrap();
// unreadable SSH dir
let path = tempdir.path().join("a");
make_dir(&path).unwrap();
set_permissions(&path, Permissions::from_mode(0)).unwrap();
do_read_keys(
&path,
"",
&format!(
"{} does not exist\n",
path.join(KEYS_SUBDIR).to_string_lossy()
),
)
.unwrap();
// unreadable KEYS_SUBDIR
let path = tempdir.path().join("b");
let subdir = path.join(KEYS_SUBDIR);
create_dir_all(&subdir).unwrap();
set_permissions(&path, Permissions::from_mode(0o700)).unwrap();
set_permissions(&subdir, Permissions::from_mode(0)).unwrap();
assert_eq!(
do_read_keys(&path, "", "").unwrap_err().to_string(),
format!("reading {}", subdir.display())
);
// unreadable key
let path = tempdir.path().join("c");
let subdir = path.join(KEYS_SUBDIR);
let file = subdir.join("z");
create_dir_all(&subdir).unwrap();
make_file(&file, "contents").unwrap();
set_permissions(&path, Permissions::from_mode(0o700)).unwrap();
set_permissions(&subdir, Permissions::from_mode(0o700)).unwrap();
set_permissions(&file, Permissions::from_mode(0)).unwrap();
do_read_keys(
&path,
"",
&format!(
"Error: opening {}\nCaused by: Permission denied (os error 13)\n\n",
file.to_string_lossy()
),
)
.unwrap();
// bad SSH dir permissions
let path = tempdir.path().join("d");
let subdir = path.join(KEYS_SUBDIR);
create_dir_all(&subdir).unwrap();
set_permissions(&path, Permissions::from_mode(0o775)).unwrap();
assert_eq!(
do_read_keys(&path, "", "").unwrap_err().to_string(),
format!("bad permission on {}: 0775 & 0022 != 0", path.display())
);
// bad KEYS_SUBDIR permissions
let path = tempdir.path().join("e");
let subdir = path.join(KEYS_SUBDIR);
create_dir_all(&subdir).unwrap();
set_permissions(&path, Permissions::from_mode(0o700)).unwrap();
set_permissions(&subdir, Permissions::from_mode(0o775)).unwrap();
assert_eq!(
do_read_keys(&path, "", "").unwrap_err().to_string(),
format!("bad permission on {}: 0775 & 0022 != 0", subdir.display())
);
// bad key permissions
let path = tempdir.path().join("f");
let subdir = path.join(KEYS_SUBDIR);
let file = subdir.join("z");
create_dir_all(&subdir).unwrap();
make_file(&file, "contents").unwrap();
set_permissions(&path, Permissions::from_mode(0o700)).unwrap();
set_permissions(&subdir, Permissions::from_mode(0o700)).unwrap();
set_permissions(&file, Permissions::from_mode(0o664)).unwrap();
do_read_keys(
&path,
"",
&format!(
"Error: bad permission on {}: 0664 & 0022 != 0\n\n",
file.to_string_lossy()
),
)
.unwrap();
// SSH dir is a file
let path = tempdir.path().join("g");
make_file(&path, "").unwrap();
set_permissions(&path, Permissions::from_mode(0o700)).unwrap();
do_read_keys(
&path,
"",
&format!(
"{} does not exist\n",
path.join(KEYS_SUBDIR).to_string_lossy()
),
)
.unwrap();
// KEYS_SUBDIR is a file
let path = tempdir.path().join("h");
create_dir_all(&path).unwrap();
let subdir = path.join(KEYS_SUBDIR);
make_file(&subdir, "").unwrap();
set_permissions(&path, Permissions::from_mode(0o700)).unwrap();
set_permissions(&subdir, Permissions::from_mode(0o700)).unwrap();
assert_eq!(
do_read_keys(&path, "", "").unwrap_err().to_string(),
format!("reading {}", subdir.display())
);
// missing SSH dir
let path = tempdir.path().join("i");
do_read_keys(
&path,
"",
&format!(
"{} does not exist\n",
path.join(KEYS_SUBDIR).to_string_lossy()
),
)
.unwrap();
// missing KEYS_SUBDIR
let path = tempdir.path().join("j");
create_dir_all(&path).unwrap();
do_read_keys(
&path,
"",
&format!(
"{} does not exist\n",
path.join(KEYS_SUBDIR).to_string_lossy()
),
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/76311 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2488
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98043,
368,
341,
286,
1077,
2730,
3741,
284,
20626,
486,
931,
1005,
11849,
445,
25537,
16173,
45283,
1827,
3888,
3741,
1005,
15454,
1428,
286,
442,
60291,
480,
40463,
5419,
198,
286,
1077,
1815,
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_stream_rx() {
let flow_mgr = Rc::new(RefCell::new(FlowMgr::default()));
let conn_events = ConnectionEvents::default();
let mut s = RecvStream::new(567.into(), 1024, flow_mgr.clone(), conn_events.clone());
// test receiving a contig frame and reading it works
s.inbound_stream_frame(false, 0, vec![1; 10]).unwrap();
assert_eq!(s.data_ready(), true);
let mut buf = vec![0u8; 100];
assert_eq!(s.read(&mut buf).unwrap(), (10, false));
assert_eq!(s.state.recv_buf().unwrap().retired(), 10);
assert_eq!(s.state.recv_buf().unwrap().buffered(), 0);
// test receiving a noncontig frame
s.inbound_stream_frame(false, 12, vec![2; 12]).unwrap();
assert_eq!(s.data_ready(), false);
assert_eq!(s.read(&mut buf).unwrap(), (0, false));
assert_eq!(s.state.recv_buf().unwrap().retired(), 10);
assert_eq!(s.state.recv_buf().unwrap().buffered(), 12);
// another frame that overlaps the first
s.inbound_stream_frame(false, 14, vec![3; 8]).unwrap();
assert_eq!(s.data_ready(), false);
assert_eq!(s.state.recv_buf().unwrap().retired(), 10);
assert_eq!(s.state.recv_buf().unwrap().buffered(), 12);
s.inbound_stream_frame(true, 10, vec![4; 6]).unwrap_err();
assert_eq!(s.data_ready(), false);
assert_eq!(s.read(&mut buf).unwrap(), (0, false));
assert_eq!(s.state.recv_buf().unwrap().retired(), 10);
assert_eq!(s.state.recv_buf().unwrap().buffered(), 12);
// fill in the gap
s.inbound_stream_frame(false, 10, vec![5; 10]).unwrap();
assert_eq!(s.data_ready(), true);
assert_eq!(s.state.recv_buf().unwrap().retired(), 10);
assert_eq!(s.state.recv_buf().unwrap().buffered(), 14);
// a legit FIN
s.inbound_stream_frame(true, 24, vec![6; 18]).unwrap();
assert_eq!(s.state.recv_buf().unwrap().retired(), 10);
assert_eq!(s.state.recv_buf().unwrap().buffered(), 32);
assert_eq!(s.data_ready(), true);
assert_eq!(s.read(&mut buf).unwrap(), (32, true));
s.read(&mut buf).unwrap_err();
} | rust_cleaned_test_functions.jsonl/22968 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1032
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12673,
24330,
368,
341,
286,
1077,
6396,
42438,
284,
81463,
486,
931,
7,
3945,
3599,
486,
931,
7,
18878,
25567,
486,
2258,
7392,
286,
1077,
4534,
19691,
284,
11032,
7900,
486,
2258,
1428,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_constraint_check_with_overlapping_txn() {
let engine = TestEngineBuilder::new().build().unwrap();
let k = b"k1";
let v = b"v1";
must_prewrite_put(&engine, k, v, k, 10);
must_commit(&engine, k, 10, 11);
must_acquire_pessimistic_lock(&engine, k, k, 5, 12);
must_pessimistic_prewrite_lock(&engine, k, k, 5, 12, true);
must_commit(&engine, k, 5, 15);
// Now in write cf:
must_get(&engine, k, 19, v);
assert!(try_prewrite_insert(&engine, k, v, k, 20).is_err());
} | rust_cleaned_test_functions.jsonl/16087 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46973,
7200,
6615,
15431,
90619,
92299,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
1428,
286,
1077,
595,
284,
293,
62911,
16,
876,
286,
1077,
348,
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_operators() {
expression_operator("name > 5")
.expect("Expecting name > 5");
let x = "age > 10 and city = 'Boston'";
// technically is this:
// need to rewrite as a bunch of nested binary ops
// do i need a second parser just to rewrite?
expression(x).expect(x);
// same as above but needed to be safe
let x = "(age > 10) and city = 'Boston'";
expression(x).expect(x);
let x = "(age > 10) and (city = 'Boston')";
expression(x).expect(x);
let x = "((age > 10) and (city = 'Boston')) or age = 3";
let y = expression(x).expect(x);
match *y {
Expression::Comparison(ref a, ref b, ref c) =>
{
assert_eq!(*a, Operator::Or);
}
_ => {
panic!("NOOO");
}
}
let x = "(field + 3) > 10";
let x = "10 > (field * 3)";
expression(x).expect(x);
} | rust_cleaned_test_functions.jsonl/114457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25634,
2973,
368,
341,
286,
7493,
40594,
445,
606,
861,
220,
20,
1138,
310,
659,
17119,
445,
17536,
287,
829,
861,
220,
20,
3071,
286,
1077,
856,
284,
330,
424,
861,
220,
16,
15,
323,
3283,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_search_forfeit() {
build_test_dir(1_000).unwrap();
let mut path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
path.push("target/debug/psbattletools");
for forfeit_arg in ["-f", "--forfeits-only"] {
let output = Command::new(&path)
.arg("search")
.arg("AnniKa")
.arg(&*TEST_ROOT_DIR)
.arg(forfeit_arg)
.output()
.expect("Failed to execute command");
assert!(output.status.success(), "command failed");
let output_str = std::str::from_utf8(&output.stdout).unwrap();
assert!(!output_str.contains("annika"));
assert!(!output_str.contains("Annika"));
assert!(output_str.split('\n').count() <= 5);
}
} | rust_cleaned_test_functions.jsonl/47628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10716,
5478,
61121,
368,
341,
262,
1936,
4452,
4334,
7,
16,
62,
15,
15,
15,
568,
15454,
543,
262,
1077,
5206,
1815,
284,
7933,
15064,
486,
1499,
5194,
486,
3160,
486,
947,
445,
34,
7581,
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... | 2 |
#[test]
fn test_header() -> Result<(), AmqpCodecError> {
let hdr = Header {
durable: false,
priority: 1,
ttl: None,
first_acquirer: false,
delivery_count: 1,
};
let mut msg = Message::default();
msg.set_header(hdr.clone());
let mut buf = BytesMut::with_capacity(msg.encoded_size());
msg.encode(&mut buf);
let msg2 = Message::decode(&buf)?.1;
assert_eq!(msg2.header().unwrap(), &hdr);
Ok(())
} | rust_cleaned_test_functions.jsonl/47639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
368,
1464,
5714,
68843,
3303,
32763,
36913,
1454,
29,
341,
286,
1077,
36615,
284,
12104,
341,
310,
26128,
25,
895,
345,
310,
10619,
25,
220,
16,
345,
310,
53932,
25,
2240,
345,
310,
1156,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_random_allocation_strategy() {
let strat = PoolingAllocationStrategy::Random;
assert!(strat.next(100) < 100);
assert_eq!(strat.next(1), 0);
} | rust_cleaned_test_functions.jsonl/48872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
81267,
49308,
368,
341,
286,
1077,
43297,
284,
22728,
287,
78316,
19816,
486,
13999,
280,
286,
2060,
10297,
495,
266,
4529,
7,
16,
15,
15,
8,
366,
220,
16,
15,
15,
317,
286,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_round_frac() {
let cases = vec![
("11:30:45.123456", 4, "11:30:45.1235"),
("11:30:45.123456", 6, "11:30:45.123456"),
("11:30:45.123456", 0, "11:30:45"),
("11:59:59.999999", 3, "12:00:00.000"),
("1 11:30:45.123456", 1, "35:30:45.1"),
("1 11:30:45.999999", 4, "35:30:46.0000"),
("-1 11:30:45.999999", 0, "-35:30:46"),
("-1 11:59:59.9999", 2, "-36:00:00.00"),
];
for (input, fsp, exp) in cases {
let t = Duration::parse(input.as_bytes(), MAX_FSP)
.unwrap()
.round_frac(fsp)
.unwrap();
let res = format!("{}", t);
assert_eq!(exp, res);
}
} | rust_cleaned_test_functions.jsonl/17462 | {
"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,
29896,
70358,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
16,
16,
25,
18,
15,
25,
19,
20,
13,
16,
17,
18,
19,
20,
21,
497,
220,
19,
11,
330,
16,
16,
25,
18,
15,
25,
19,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_permissions_request_env() {
let guard = PERMISSION_PROMPT_GUARD.lock().unwrap();
let mut perms0 = DenoPermissions::from_flags(&Flags {
..Default::default()
});
set_prompt_result(true);
assert_eq!(perms0.request_env(), PermissionState::Allow);
let mut perms1 = DenoPermissions::from_flags(&Flags {
..Default::default()
});
set_prompt_result(false);
assert_eq!(perms1.request_env(), PermissionState::Deny);
drop(guard);
} | rust_cleaned_test_functions.jsonl/78062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44767,
7893,
15879,
368,
341,
262,
1077,
7616,
284,
96540,
71346,
2828,
84513,
7376,
21003,
1005,
15454,
543,
262,
1077,
5206,
82282,
15,
284,
9774,
78,
23851,
486,
1499,
14130,
2099,
9195,
341,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_line_size() {
// We should make sure to not regress the size of the Line struct because
// it is unconditional overhead for every line we sort.
assert_eq!(std::mem::size_of::<Line>(), 24);
} | rust_cleaned_test_functions.jsonl/31609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6528,
2368,
368,
341,
286,
442,
1205,
1265,
1281,
2704,
311,
537,
69780,
279,
1379,
315,
279,
7083,
2036,
1576,
198,
286,
442,
432,
374,
83563,
31015,
369,
1449,
1555,
582,
3378,
624,
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 |
#[test]
fn test_cli_parse_show() {
let test_commands = get_clap_app("test", "desc", "version");
let default_keypair = Keypair::new();
let keypair_file = make_tmp_path("keypair_file");
write_keypair_file(&default_keypair, &keypair_file).unwrap();
let default_signer = DefaultSigner::new("", &keypair_file);
// defaults
let buffer_pubkey = Pubkey::new_unique();
let authority_keypair = Keypair::new();
let authority_keypair_file = make_tmp_path("authority_keypair_file");
write_keypair_file(&authority_keypair, &authority_keypair_file).unwrap();
let test_command = test_commands.clone().get_matches_from(vec![
"test",
"program",
"show",
&buffer_pubkey.to_string(),
]);
assert_eq!(
parse_command(&test_command, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Show {
account_pubkey: Some(buffer_pubkey),
authority_pubkey: default_keypair.pubkey(),
get_programs: false,
get_buffers: false,
all: false,
use_lamports_unit: false,
}),
signers: vec![],
}
);
let test_command = test_commands.clone().get_matches_from(vec![
"test",
"program",
"show",
"--programs",
"--all",
"--lamports",
]);
assert_eq!(
parse_command(&test_command, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Show {
account_pubkey: None,
authority_pubkey: default_keypair.pubkey(),
get_programs: true,
get_buffers: false,
all: true,
use_lamports_unit: true,
}),
signers: vec![],
}
);
let test_command = test_commands.clone().get_matches_from(vec![
"test",
"program",
"show",
"--buffers",
"--all",
"--lamports",
]);
assert_eq!(
parse_command(&test_command, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Show {
account_pubkey: None,
authority_pubkey: default_keypair.pubkey(),
get_programs: false,
get_buffers: true,
all: true,
use_lamports_unit: true,
}),
signers: vec![],
}
);
let test_command = test_commands.clone().get_matches_from(vec![
"test",
"program",
"show",
"--buffers",
"--buffer-authority",
&authority_keypair.pubkey().to_string(),
]);
assert_eq!(
parse_command(&test_command, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Show {
account_pubkey: None,
authority_pubkey: authority_keypair.pubkey(),
get_programs: false,
get_buffers: true,
all: false,
use_lamports_unit: false,
}),
signers: vec![],
}
);
let test_command = test_commands.clone().get_matches_from(vec![
"test",
"program",
"show",
"--buffers",
"--buffer-authority",
&authority_keypair_file,
]);
assert_eq!(
parse_command(&test_command, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Show {
account_pubkey: None,
authority_pubkey: authority_keypair.pubkey(),
get_programs: false,
get_buffers: true,
all: false,
use_lamports_unit: false,
}),
signers: vec![],
}
);
} | rust_cleaned_test_functions.jsonl/61486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
21039,
15267,
368,
341,
286,
1077,
1273,
44151,
284,
633,
6794,
391,
8191,
445,
1944,
497,
330,
8614,
497,
330,
4366,
3071,
286,
1077,
1638,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decoder_invalid_lead_followed_by_invalid_trail() {
for i in 0x81..0xff {
let mut d = BigFive2003Encoding.raw_decoder();
assert_feed_err!(d, [], [i, 0x80], [0x20], "");
assert_feed_err!(d, [], [i, 0xff], [0x20], "");
assert_finish_ok!(d, "");
let mut d = BigFive2003Encoding.raw_decoder();
assert_feed_ok!(d, [], [i], "");
assert_feed_err!(d, [], [0x80], [0x20], "");
assert_feed_ok!(d, [], [i], "");
assert_feed_err!(d, [], [0xff], [0x20], "");
assert_finish_ok!(d, "");
}
// 80/FF is not a valid lead and the trail is not consumed
let mut d = BigFive2003Encoding.raw_decoder();
assert_feed_err!(d, [], [0x80], [0x80], "");
assert_feed_err!(d, [], [0x80], [0xff], "");
assert_feed_err!(d, [], [0xff], [0x80], "");
assert_feed_err!(d, [], [0xff], [0xff], "");
assert_finish_ok!(d, "");
} | rust_cleaned_test_functions.jsonl/128692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 570
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
31433,
87052,
43490,
291,
3710,
31433,
3547,
604,
368,
341,
16885,
286,
369,
600,
304,
220,
15,
87,
23,
16,
496,
15,
9020,
341,
310,
1077,
5206,
294,
284,
6164,
37020,
17,
15,
15,
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... | 2 |
#[test]
fn test_add_precompiled_account_squatted_while_not_replacing() {
let (genesis_config, mint_keypair) = create_genesis_config(100_000);
let bank = Bank::new_for_tests(&genesis_config);
let program_id = solana_sdk::pubkey::new_rand();
// someone managed to squat at program_id!
bank.withdraw(&mint_keypair.pubkey(), 10).unwrap();
assert_ne!(bank.capitalization(), bank.calculate_capitalization(true));
bank.deposit(&program_id, 10).unwrap();
assert_eq!(bank.capitalization(), bank.calculate_capitalization(true));
bank.add_precompiled_account(&program_id);
assert_eq!(bank.capitalization(), bank.calculate_capitalization(true));
} | rust_cleaned_test_functions.jsonl/28959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
10442,
50845,
13500,
643,
446,
12127,
86069,
7913,
1288,
47933,
368,
341,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
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_process_data() {
let raw_data = "Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 475788360 389354068 62242600 87% /";
let total = 475788360;
let used = 475788360 - 62242600;
assert_parse(raw_data, total, used);
assert_parse("", 0, 0);
} | rust_cleaned_test_functions.jsonl/19792 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
1769,
368,
341,
286,
1077,
7112,
1769,
284,
330,
1703,
8948,
257,
220,
16,
42,
9425,
82,
414,
12199,
16136,
5443,
4,
92741,
389,
198,
35061,
2687,
3235,
16,
414,
220,
19,
22,
20,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lazy_reverse() {
let df = load_df();
assert!(df
.clone()
.lazy()
.reverse()
.collect()
.unwrap()
.frame_equal_missing(&df.reverse()))
} | rust_cleaned_test_functions.jsonl/129 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49646,
43277,
368,
341,
262,
1077,
6764,
284,
2795,
10894,
543,
262,
2060,
10297,
2940,
198,
286,
659,
19982,
741,
286,
659,
49013,
741,
286,
659,
25903,
741,
286,
659,
17384,
741,
286,
659,
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 |
#[test]
fn test_storage_compact() {
let ents = vec![new_entry(3, 3), new_entry(4, 4), new_entry(5, 5)];
let mut tests = vec![
(2, Err(RaftError::Store(StorageError::Compacted))),
(3, Err(RaftError::Store(StorageError::Compacted))),
(4, Ok(())),
(5, Ok(())),
];
for (i, (idx, werr)) in tests.drain(..).enumerate() {
let td = Builder::new().prefix("tikv-store-test").tempdir().unwrap();
let worker = Worker::new("snap-manager").lazy_build("snap-manager");
let sched = worker.scheduler();
let mut store = new_storage_from_ents(sched, &td, &ents);
let res = store
.term(idx)
.map_err(From::from)
.and_then(|term| compact_raft_log(&store.tag, &mut store.apply_state, idx, term));
// TODO check exact error type after refactoring error.
if res.is_err() ^ werr.is_err() {
panic!("#{}: want {:?}, got {:?}", i, werr, res);
}
if res.is_ok() {
let mut kv_wb = store.engines.kv.write_batch();
store.save_apply_state_to(&mut kv_wb).unwrap();
kv_wb.write().unwrap();
}
}
} | rust_cleaned_test_functions.jsonl/12742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 692
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
18177,
531,
368,
341,
286,
1077,
36852,
284,
7486,
20703,
931,
9078,
7,
18,
11,
220,
18,
701,
501,
9078,
7,
19,
11,
220,
19,
701,
501,
9078,
7,
20,
11,
220,
20,
12587,
286,
1077,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_zero_rand_range() {
task_rng().gen_biguint_range(&FromPrimitive::from_uint(54).unwrap(),
&FromPrimitive::from_uint(54).unwrap());
} | rust_cleaned_test_functions.jsonl/96916 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
33864,
9698,
368,
341,
286,
3383,
66849,
1005,
4370,
36386,
2496,
9698,
2099,
3830,
33313,
486,
1499,
15807,
7,
20,
19,
568,
15454,
3148,
10589,
609,
3830,
33313,
486,
1499,
15807,
7,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_consistency_from_cursor() {
assert_eq!(
Consistency::from_cursor(&mut Cursor::new(&[0, 0])).unwrap(),
Consistency::Any
);
assert_eq!(
Consistency::from_cursor(&mut Cursor::new(&[0, 1])).unwrap(),
Consistency::One
);
assert_eq!(
Consistency::from_cursor(&mut Cursor::new(&[0, 2])).unwrap(),
Consistency::Two
);
assert_eq!(
Consistency::from_cursor(&mut Cursor::new(&[0, 3])).unwrap(),
Consistency::Three
);
assert_eq!(
Consistency::from_cursor(&mut Cursor::new(&[0, 4])).unwrap(),
Consistency::Quorum
);
assert_eq!(
Consistency::from_cursor(&mut Cursor::new(&[0, 5])).unwrap(),
Consistency::All
);
assert_eq!(
Consistency::from_cursor(&mut Cursor::new(&[0, 6])).unwrap(),
Consistency::LocalQuorum
);
assert_eq!(
Consistency::from_cursor(&mut Cursor::new(&[0, 7])).unwrap(),
Consistency::EachQuorum
);
assert_eq!(
Consistency::from_cursor(&mut Cursor::new(&[0, 8])).unwrap(),
Consistency::Serial
);
assert_eq!(
Consistency::from_cursor(&mut Cursor::new(&[0, 9])).unwrap(),
Consistency::LocalSerial
);
assert_eq!(
Consistency::from_cursor(&mut Cursor::new(&[0, 10])).unwrap(),
Consistency::LocalOne
);
} | rust_cleaned_test_functions.jsonl/97973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 861
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31971,
47094,
5673,
28601,
368,
341,
286,
2060,
10714,
33673,
310,
7292,
47094,
486,
1499,
28601,
2099,
6984,
28067,
486,
931,
2099,
58,
15,
11,
220,
15,
54697,
15454,
3148,
310,
7292,
47094,
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_valid_hex() {
let res: Result<RgbColor, Error> = "#00ff00".parse();
assert!(res.is_ok());
assert_eq!(res.unwrap(), RgbColor(0, 255, 0));
} | rust_cleaned_test_functions.jsonl/46476 | {
"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,
8337,
32655,
368,
341,
286,
1077,
592,
25,
5714,
23370,
9511,
1636,
11,
4600,
29,
284,
5869,
15,
15,
542,
15,
15,
3263,
6400,
543,
286,
2060,
10297,
416,
2079,
19817,
1423,
286,
2060,
10714,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ignore_message_with_incorrect_signature() {
let sandbox = timestamping_sandbox();
let propose = sandbox.create_propose(
ValidatorId(0),
Height(0),
Round(1),
&sandbox.last_hash(),
&[],
sandbox.s(ValidatorId(1)),
);
sandbox.recv(&propose);
} | rust_cleaned_test_functions.jsonl/65639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
6462,
6615,
1243,
19928,
39859,
368,
341,
262,
1077,
42754,
284,
11441,
287,
643,
31536,
1428,
262,
1077,
29614,
284,
42754,
2520,
21663,
960,
1006,
286,
32566,
764,
7,
15,
1326,
286,
21432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_str_combine() {
if let Ok(r) = StrCombine::from_file("src/term_strz.bin") {
assert_eq!(r.str_term, "foo");
assert_eq!(r.str_limit, "bar|");
assert_eq!(r.str_eos, "baz@");
assert_eq!(r.str_calc, "bar");
assert_eq!(r.str_calc_bytes, "baz");
assert_eq!(r.term_or_limit, "foo");
assert_eq!(r.term_or_eos, "baz@");
assert_eq!(r.term_or_calc, "foo");
assert_eq!(r.term_or_calc_bytes, "baz");
assert_eq!(r.limit_or_eos, "bar|");
assert_eq!(r.limit_or_calc, "bar");
assert_eq!(r.limit_or_calc_bytes, "bar|");
assert_eq!(r.eos_or_calc, "bar");
assert_eq!(r.eos_or_calc_bytes, "baz@");
assert_eq!(r.calc_or_calc_bytes, "baz");
}
} | rust_cleaned_test_functions.jsonl/84157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 443
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
72374,
368,
341,
262,
421,
1077,
7622,
2601,
8,
284,
4509,
81114,
486,
1499,
2458,
445,
3548,
14,
4991,
2895,
89,
29394,
899,
1476,
286,
2060,
10714,
10297,
81,
9528,
17464,
11,
330,
7975,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_report_construct() {
let mut bytes = vec![0xa5; 8];
let mut packet = Packet::new_unchecked(&mut bytes);
packet.set_msg_type(Message::MembershipReportV2);
packet.set_max_resp_code(0);
packet.set_group_address(Ipv4Address::from_bytes(&[225, 0, 0, 37]));
packet.fill_checksum();
assert_eq!(&packet.into_inner()[..], &REPORT_PACKET_BYTES[..]);
} | rust_cleaned_test_functions.jsonl/112387 | {
"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,
14813,
64803,
368,
341,
286,
1077,
5206,
5820,
284,
7486,
20703,
15,
9591,
20,
26,
220,
23,
935,
286,
1077,
5206,
10151,
284,
28889,
486,
931,
4907,
7549,
2099,
6984,
5820,
317,
286,
10151,
980,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_special_key() {
for mut test in new_test_suits().drain(..) {
test.add(b"\xff\xff", b"v");
test.do_test();
}
} | rust_cleaned_test_functions.jsonl/22550 | {
"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,
41629,
3097,
368,
341,
286,
369,
5206,
1273,
304,
501,
4452,
643,
11797,
1005,
3612,
466,
56422,
8,
341,
310,
1273,
1364,
1883,
11934,
9020,
86977,
497,
293,
1,
85,
797,
310,
1273,
16521,
4452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_compressed_file() {
assert_decompressed_input_matches_output(include_bytes!("../../testdata/compressed_file.compressed"),
include_bytes!("../../testdata/compressed_file"),
65536,
65536);
} | rust_cleaned_test_functions.jsonl/26429 | {
"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,
2965,
14318,
2458,
368,
341,
220,
2060,
2259,
45703,
5898,
38344,
7645,
77863,
12524,
17223,
2748,
92425,
25093,
14318,
2458,
905,
14318,
4461,
14265,
2924,
12524,
17223,
2748,
92425,
25093,
14318,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_i24() {
let i24_sample = to_f32_to_i24(0x0a0b0c00);
check_i24(i24_sample, [0x0a, 0x0b, 0x0c]);
let i24_sample = to_f32_to_i24(0x0a0b0d00);
check_i24(i24_sample, [0x0a, 0x0b, 0x0d]);
let i24_sample = to_f32_to_i24(0x0a0b0e00);
check_i24(i24_sample, [0x0a, 0x0b, 0x0e]);
let i24_sample = to_f32_to_i24(0x0a0b0f00);
check_i24(i24_sample, [0x0a, 0x0b, 0x0f]);
let i24_sample = to_f32_to_i24(0 - 0x0a0b0c00); // F5F4F400
check_i24(i24_sample, [0xF5, 0xF4, 0xF4]);
} | rust_cleaned_test_functions.jsonl/42457 | {
"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,
5318,
17,
19,
368,
341,
286,
1077,
600,
17,
19,
17491,
284,
311,
761,
18,
17,
2346,
5318,
17,
19,
7,
15,
87,
15,
64,
15,
65,
15,
66,
15,
15,
317,
286,
1779,
5318,
17,
19,
1956,
17,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sub() {
let point = Point3::new(1.0, -4.0, 12.0);
let vec = Vec3::new(5.0, -7.0, -11.0);
let ans = point - vec;
assert_approx_eq!(ans.x(), -4.0);
assert_approx_eq!(ans.y(), 3.0);
assert_approx_eq!(ans.z(), 23.0);
} | rust_cleaned_test_functions.jsonl/131703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
368,
341,
286,
1077,
1459,
284,
5126,
18,
486,
931,
7,
16,
13,
15,
11,
481,
19,
13,
15,
11,
220,
16,
17,
13,
15,
317,
286,
1077,
7486,
284,
11312,
18,
486,
931,
7,
20,
13,
15,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_create_ok() {
solana_logger::setup();
let keys = vec![];
let (_, config_account) = create_config_account(keys);
assert_eq!(
Some(MyConfig::default()),
deserialize(get_config_data(config_account.borrow().data()).unwrap()).ok()
);
} | rust_cleaned_test_functions.jsonl/4684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
8657,
19817,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
6894,
284,
7486,
0,
15078,
286,
1077,
39464,
2193,
13500,
8,
284,
1855,
5332,
13500,
36131,
317,
286,
2060,
10714,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chained_assignment() {
test("var a = 2, b = 2; var c = b;", "var a, b; var c;");
test("var a = 2, b = 2; var c = a;", "var a, b; var c;");
test(
"var a = b = 2; var f = 3; var c = a;",
"var a; var f; var c = b = 2;",
);
test_same("var a = b = 2; var c;");
} | rust_cleaned_test_functions.jsonl/27632 | {
"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,
4138,
2627,
51891,
368,
341,
262,
1273,
445,
947,
264,
284,
220,
17,
11,
293,
284,
220,
17,
26,
762,
272,
284,
293,
32503,
330,
947,
264,
11,
293,
26,
762,
272,
34649,
262,
1273,
445,
947,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unary_op_overflow() {
let tests = vec![
(ScalarFuncSig::UnaryMinusInt, Datum::I64(i64::MIN)),
(
ScalarFuncSig::UnaryMinusInt,
Datum::U64(i64::MAX as u64 + 2),
),
];
let mut ctx = EvalContext::default();
for (op, argument) in tests {
let arg = datum_expr(argument);
let op = Expression::build(&ctx, scalar_func_expr(op, &[arg])).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap_err();
assert!(check_overflow(got).is_ok());
}
} | rust_cleaned_test_functions.jsonl/16153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
658,
10287,
79073,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
20639,
9626,
47246,
486,
94545,
74458,
1072,
11,
68459,
486,
40,
21,
19,
1956,
21,
19,
486,
16413,
6965,
310,
2399... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ngram() {
assert_eq!(
extract_clean_word_ngrams(
&vec!["mary".to_string(), "had".to_string(), "a".to_string()],
2
),
vec!["mary had", "had a"]
);
assert_eq!(
extract_clean_word_ngrams(&clean_text(" ||| mary\n @@@@ .... had a\n\n\n"), 2),
vec!["mary had", "had a"]
);
} | rust_cleaned_test_functions.jsonl/119097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
1520,
368,
341,
286,
2060,
10714,
33673,
310,
8649,
19573,
13533,
1089,
50770,
1006,
394,
609,
4083,
0,
1183,
1534,
3263,
983,
3904,
1507,
330,
31245,
3263,
983,
3904,
1507,
330,
64,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_untyped_json() -> () {
let mut msg = trajectory_msgs::msg::JointTrajectoryPoint::default();
msg.positions.push(39.0);
msg.positions.push(34.0);
let json = serde_json::to_value(msg.clone()).unwrap();
let mut native = WrappedNativeMsgUntyped::new_from("trajectory_msgs/msg/JointTrajectoryPoint").unwrap();
native.from_json(json.clone()).unwrap();
let json2 = native.to_json().unwrap();
assert_eq!(json, json2);
let msg2: trajectory_msgs::msg::JointTrajectoryPoint = serde_json::from_value(json2).unwrap();
assert_eq!(msg, msg2);
} | rust_cleaned_test_functions.jsonl/28024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
44181,
9455,
368,
1464,
1719,
341,
286,
1077,
5206,
3750,
284,
34682,
20777,
486,
3236,
486,
40997,
48138,
23363,
2609,
486,
2258,
543,
286,
3750,
79513,
2552,
7,
18,
24,
13,
15,
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_unsupported_item_has_item_id() {
let ir = ir_from_cc("struct SomeStruct { struct NestedStruct {}; };").unwrap();
let unsupported =
ir.unsupported_items().find(|i| i.name == "SomeStruct::NestedStruct").unwrap();
assert_ne!(unsupported.id, ItemId(0));
} | rust_cleaned_test_functions.jsonl/37231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
18216,
5634,
21778,
5634,
842,
368,
341,
262,
1077,
6216,
284,
6216,
5673,
28955,
445,
1235,
4329,
9422,
314,
2036,
71742,
9422,
52166,
20066,
1827,
15454,
543,
262,
1077,
40409,
4035,
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_unit_reactions() {
assert!(units_react('a', 'A'));
assert!(units_react('A', 'a'));
assert!(units_react('z', 'Z'));
assert!(!units_react('a', 'a'));
assert!(!units_react('A', 'A'));
assert!(!units_react('a', 'B'));
} | rust_cleaned_test_functions.jsonl/89826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14832,
1288,
4020,
368,
341,
286,
2060,
10297,
25643,
1288,
531,
492,
64,
516,
364,
32,
6336,
286,
2060,
10297,
25643,
1288,
531,
492,
32,
516,
364,
64,
6336,
286,
2060,
10297,
25643,
1288,
531,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vector_3() {
let alicesk = Scalar([0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d
,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45
,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a
,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a]);
let bobpk = GroupElement([0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4
,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37
,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d
,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f]);
let k_expected = [0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1
,0x72,0x8e,0x3b,0xf4,0x80,0x35,0x0f,0x25
,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33
,0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42];
let GroupElement(k) = scalarmult(&alicesk, &bobpk);
assert!(k == k_expected);
} | rust_cleaned_test_functions.jsonl/99768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 805
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
62,
18,
368,
341,
1789,
286,
1077,
264,
37414,
74,
284,
35176,
2561,
15,
87,
22,
22,
11,
15,
87,
15,
22,
11,
15,
87,
21,
67,
11,
15,
87,
15,
64,
11,
15,
87,
22,
18,
11,
15,
87... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make_path_simple_cases() {
assert_eq!("abcd/efgh", make_path(&["abcd", "efgh"]));
assert_eq!(
"/usb/folder1/test.sbx/",
make_path(&["/usb/", "folder1/", "test.sbx/"])
);
assert_eq!("/abcd/efgh", make_path(&["/abcd/", "efgh"]));
assert_eq!("/abcd/efgh/", make_path(&["/abcd", "efgh/"]));
assert_eq!("/efgh/", make_path(&["/", "efgh/"]));
assert_eq!("/test", make_path(&["/", "test"]));
} | rust_cleaned_test_functions.jsonl/96751 | {
"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,
28230,
2638,
30015,
41427,
368,
341,
262,
2060,
10714,
17223,
68644,
14,
823,
866,
497,
1281,
2638,
2099,
1183,
68644,
497,
330,
823,
866,
74446,
262,
2060,
10714,
33673,
286,
3521,
24343,
6663,
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_running_allowed_when_having_normal_root_privileges() -> Result<(), Box<dyn error::Error>> {
let image = build_image(&[
"RUN addgroup --gid 1234 app",
"RUN adduser --uid 1234 --gid 1234 --gecos '' --disabled-password app",
])?;
let output = run_container(&image, &[], &[])?;
assert_contains_substr!(
output.text,
"Current process's privileges: uid=0 gid=0 euid=0 egid=0"
);
assert_eq!(Some(0), output.status.code());
Ok(())
} | rust_cleaned_test_functions.jsonl/90910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37333,
42155,
47636,
1523,
2317,
13973,
12993,
24726,
70838,
368,
1464,
5714,
68843,
8261,
92846,
1465,
486,
1454,
2452,
341,
262,
1077,
2168,
284,
1936,
4954,
2099,
9640,
286,
330,
47390,
912,
4074... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fuzz_load() {
let mut rng = rand::thread_rng();
let range = Uniform::new(0, 255);
println!("random bytes");
for _ in 0..1_000 {
let elf_bytes: Vec<u8> = (0..100).map(|_| rng.sample(&range)).collect();
let _ = ElfExecutable::load(Config::default(), &elf_bytes);
}
// Take a real elf and mangle it
let mut file = File::open("tests/elfs/noop.so").expect("file open failed");
let mut elf_bytes = Vec::new();
file.read_to_end(&mut elf_bytes)
.expect("failed to read elf file");
let parsed_elf = Elf::parse(&elf_bytes).unwrap();
println!("mangle elf header");
fuzz(
&elf_bytes,
1_000_000,
100,
0..parsed_elf.header.e_ehsize as usize,
0..255,
|bytes: &mut [u8]| {
let _ = ElfExecutable::load(Config::default(), bytes);
},
);
// focus on section headers
println!("mangle section headers");
fuzz(
&elf_bytes,
1_000_000,
100,
parsed_elf.header.e_shoff as usize..elf_bytes.len(),
0..255,
|bytes: &mut [u8]| {
let _ = ElfExecutable::load(Config::default(), bytes);
},
);
// mangle whole elf randomly
println!("mangle whole elf");
fuzz(
&elf_bytes,
1_000_000,
100,
0..elf_bytes.len(),
0..255,
|bytes: &mut [u8]| {
let _ = ElfExecutable::load(Config::default(), bytes);
},
);
} | rust_cleaned_test_functions.jsonl/55868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 939
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
8889,
12411,
368,
341,
1789,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
2088,
284,
47889,
486,
931,
7,
15,
11,
220,
17,
20,
20,
317,
286,
13751,
17223,
11463,
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... | 2 |
#[test]
fn test_indexing() {
let mut schema_builder = Schema::builder();
let id_field = schema_builder.add_u64_field("id", INDEXED);
let multiples_field = schema_builder.add_u64_field("multiples", INDEXED);
let schema = schema_builder.build();
let index = Index::create_from_tempdir(schema).unwrap();
let reader = index.reader().unwrap();
let mut rng = thread_rng();
let mut index_writer = index.writer_with_num_threads(3, 120_000_000).unwrap();
let mut committed_docs: HashSet<u64> = HashSet::new();
let mut uncommitted_docs: HashSet<u64> = HashSet::new();
for _ in 0..200 {
let random_val = rng.gen_range(0, 20);
if random_val == 0 {
index_writer.commit().expect("Commit failed");
committed_docs.extend(&uncommitted_docs);
uncommitted_docs.clear();
reader.reload().unwrap();
let searcher = reader.searcher();
// check that everything is correct.
check_index_content(&searcher, &committed_docs);
} else {
if committed_docs.remove(&random_val) || uncommitted_docs.remove(&random_val) {
let doc_id_term = Term::from_field_u64(id_field, random_val);
index_writer.delete_term(doc_id_term);
} else {
uncommitted_docs.insert(random_val);
let mut doc = Document::new();
doc.add_u64(id_field, random_val);
for i in 1u64..10u64 {
doc.add_u64(multiples_field, random_val * i);
}
index_writer.add_document(doc);
}
}
}
} | rust_cleaned_test_functions.jsonl/32162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 786
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
287,
368,
341,
262,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
1428,
262,
1077,
877,
5013,
284,
10802,
28532,
1364,
7300,
21,
19,
5013,
445,
307,
497,
39300,
1479,
317,
262,
1077,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_request_context() {
let params = ServiceContextParams {
tx_hash: None,
nonce: None,
cycles_limit: 100,
cycles_price: 8,
cycles_used: Rc::new(RefCell::new(10)),
caller: Address::from_hash(Hash::from_empty()).unwrap(),
height: 1,
timestamp: 0,
service_name: "service_name".to_owned(),
service_method: "service_method".to_owned(),
service_payload: "service_payload".to_owned(),
extra: None,
events: Rc::new(RefCell::new(vec![])),
};
let ctx = ServiceContext::new(params);
ctx.sub_cycles(8);
assert_eq!(ctx.get_cycles_used(), 18);
assert_eq!(ctx.get_cycles_limit(), 100);
assert_eq!(ctx.get_cycles_price(), 8);
assert_eq!(
ctx.get_caller(),
Address::from_hash(Hash::from_empty()).unwrap()
);
assert_eq!(ctx.get_current_height(), 1);
assert_eq!(ctx.get_timestamp(), 0);
assert_eq!(ctx.get_service_name(), "service_name");
assert_eq!(ctx.get_service_method(), "service_method");
assert_eq!(ctx.get_payload(), "service_payload");
} | rust_cleaned_test_functions.jsonl/24987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 705
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
8467,
368,
341,
286,
1077,
3628,
284,
5362,
1972,
4870,
341,
310,
9854,
8950,
25,
260,
2240,
345,
310,
39676,
25,
1843,
2240,
345,
310,
24484,
14763,
25,
262,
220,
16,
15,
15,
345,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fp2_mul_nonresidue() {
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
0xbc, 0xe5,
]);
let nqr = Fp2::new(Fp::one(), Fp::one());
for _ in 0..1000 {
let mut a = Fp2::random(&mut rng);
let mut b = a;
a.mul_by_nonresidue();
b *= &nqr;
assert_eq!(a, b);
}
} | rust_cleaned_test_functions.jsonl/62491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34160,
17,
24944,
21637,
416,
60607,
368,
341,
286,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
8956,
310,
220,
15,
87,
20,
24,
11,
220,
15,
87,
21,
17,
11,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_is_finite() {
let nan: f64 = Float::nan();
let inf: f64 = Float::infinity();
let neg_inf: f64 = Float::neg_infinity();
assert!(!nan.is_finite());
assert!(!inf.is_finite());
assert!(!neg_inf.is_finite());
assert!(0.0f64.is_finite());
assert!(42.8f64.is_finite());
assert!((-109.2f64).is_finite());
} | rust_cleaned_test_functions.jsonl/7428 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
761,
15856,
368,
341,
286,
1077,
20021,
25,
282,
21,
19,
284,
13001,
486,
18759,
543,
286,
1077,
4132,
25,
282,
21,
19,
284,
13001,
486,
80016,
543,
286,
1077,
4184,
26051,
25,
282,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookup_pixel() {
let searcher = TzSearch::new();
let tests = [
(9200, 2410, Some("Asia/Phnom_Penh")),
(9047, 2488, Some("Asia/Phnom_Penh")),
// one-bit leaf tile:
(9290, 530, Some("Asia/Krasnoyarsk")),
(9290, 531, Some("Asia/Yakutsk")),
// four-bit tile:
(2985, 1654, Some("America/Indiana/Vincennes")),
(2986, 1654, Some("America/Indiana/Marengo")),
(2986, 1655, Some("America/Indiana/Tell_City")),
// Empty tile:
(4000, 2000, None),
// Big 1-color tile in ocean with island:
(3687, 1845, Some("Atlantic/Bermuda")),
(1747, 1486, Some("America/Los_Angeles")),
// Little solid tile:
(2924, 2316, Some("America/Belize")),
];
for &(lat, lon, ref want) in &tests {
assert_eq!(searcher.lookup_pixel(lat, lon), want.map(|s| s.to_string()));
}
} | rust_cleaned_test_functions.jsonl/21130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 564
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
29760,
368,
341,
286,
1077,
94674,
284,
350,
89,
5890,
486,
931,
543,
286,
1077,
7032,
284,
2278,
310,
320,
24,
17,
15,
15,
11,
220,
17,
19,
16,
15,
11,
4329,
445,
38463,
14,
3357,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_enrich_audio_without_labels() {
let v = EventValue::Summary(SummaryValue(Box::new(Value::Tensor(pb::TensorProto {
dtype: pb::DataType::DtString.into(),
tensor_shape: Some(tensor_shape(&[3])),
string_val: vec![
Bytes::from_static(b"RIFFwav0"),
Bytes::from_static(b"RIFFwav1"),
Bytes::from_static(b"RIFFwav2"),
],
..Default::default()
}))));
let expected = BlobSequenceValue(vec![
Bytes::from_static(b"RIFFwav0"),
Bytes::from_static(b"RIFFwav1"),
Bytes::from_static(b"RIFFwav2"),
]);
assert_eq!(
v.into_blob_sequence(&blank(plugin_names::AUDIO, pb::DataClass::BlobSequence)),
Ok(expected)
);
} | rust_cleaned_test_functions.jsonl/6225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 537
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
13851,
29688,
39904,
14547,
368,
341,
310,
1077,
348,
284,
3665,
1130,
486,
19237,
3759,
372,
1534,
1130,
67758,
486,
931,
25346,
486,
25336,
76878,
486,
25336,
31549,
341,
394,
13231,
25,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_tx_default_locktime_cltv() {
let (wallet, _, _) = get_funded_wallet(get_test_single_sig_cltv());
let addr = wallet.get_new_address().unwrap();
let (psbt, _) = wallet
.create_tx(TxBuilder::with_recipients(vec![(
addr.script_pubkey(),
25_000,
)]))
.unwrap();
assert_eq!(psbt.global.unsigned_tx.lock_time, 100_000);
} | rust_cleaned_test_functions.jsonl/11313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
17805,
9993,
9818,
1678,
6794,
22209,
368,
341,
286,
1077,
320,
35735,
11,
8358,
27439,
284,
633,
761,
36053,
62308,
5433,
4452,
19487,
29252,
6794,
22209,
1423,
286,
1077,
10789,
284,
15085,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_packed_to_packed() {
let mut test = TestPacked::new();
test.varints = vec![17i32, 1000];
test_deserialize("22 03 11 e8 07", &test);
let mut test = TestPacked::new();
test.sfixed32s = vec![17i32, 1000];
test_deserialize("2a 08 11 00 00 00 e8 03 00 00", &test);
} | rust_cleaned_test_functions.jsonl/47070 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
620,
11191,
2346,
620,
11191,
368,
341,
262,
1077,
5206,
1273,
284,
3393,
47,
11191,
486,
931,
543,
262,
1273,
19526,
21042,
284,
7486,
20703,
16,
22,
72,
18,
17,
11,
220,
16,
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_pascal_strings() {
let array = UCharArray::try_from(&["eenie", "meenie", "minie", "moe"][..])
.expect("created with success");
let array_len = array.len();
let (strings, strlens, len) = unsafe { array.as_pascal_strings() };
assert_eq!(len, array_len);
let reconstructed = unsafe { UCharArray::from_raw_parts(strings, strlens, len) };
let result = reconstructed
.as_ref()
.iter()
.map(|e| String::try_from(e).expect("conversion is a success"))
.collect::<Vec<String>>();
assert_eq!(vec!["eenie", "meenie", "minie", "moe"], result);
} | rust_cleaned_test_functions.jsonl/126133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
35840,
33500,
368,
341,
286,
1077,
1334,
284,
547,
40326,
486,
1539,
5673,
2099,
1183,
14911,
645,
497,
330,
2660,
61558,
497,
330,
1065,
645,
497,
330,
76,
4644,
18121,
496,
2546,
310,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_print() {
struct LogCollector(Arc<Mutex<Vec<String>>>);
impl Log for LogCollector {
fn enabled(&self, _: &LogMetadata) -> bool {
true
}
fn log(&self, record: &LogRecord) {
let mut buf = self.0.lock().unwrap();
buf.push(format!("{}", record.args()));
}
}
let buffer = Arc::new(Mutex::new(vec![]));
let collector = LogCollector(buffer.clone());
log::set_logger(|e| {
e.set(LogLevelFilter::Info);
Box::new(collector)
}).unwrap();
let point = FailPoint::new();
point.set_actions("", vec![Action::new(Task::Print(None), 1.0, None)]);
assert!(point.eval("test_fail_point_print").is_none());
let msg = buffer.lock().unwrap().pop().unwrap();
assert_eq!(msg, "failpoint test_fail_point_print executed.");
} | rust_cleaned_test_functions.jsonl/18299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
368,
341,
286,
2036,
2835,
53694,
4346,
1287,
33274,
9371,
50439,
3464,
20154,
317,
286,
11605,
2835,
369,
2835,
53694,
341,
310,
5168,
8970,
2099,
721,
11,
58536,
609,
2201,
14610,
8,
1464... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_render() {
fn test(text: &str, line_offset: u16, offset_y: u16) {
let size = (100, 20).into();
let mut layout = Layout::new(0, size);
let mut backend = TestBackend::new(size);
let mut input = StringInput::default();
input.set_value(text.into());
input.render(&mut layout, &mut backend).unwrap();
crate::assert_backend_snapshot!(backend);
assert_eq!(
layout,
Layout::new(0, size)
.with_line_offset(line_offset)
.with_offset(0, offset_y)
);
}
test("Hello, World!", 13, 0);
test(LOREM, 70, 4);
test(UNICODE, 70, 4);
} | rust_cleaned_test_functions.jsonl/63667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22781,
368,
341,
286,
5168,
1273,
7235,
25,
609,
495,
11,
1555,
6917,
25,
575,
16,
21,
11,
4347,
4178,
25,
575,
16,
21,
8,
341,
310,
1077,
1379,
284,
320,
16,
15,
15,
11,
220,
17,
15,
56... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_node() -> Result<()> {
let l = default_logger();
let mut r = new_test_raft(1, vec![1, 2], 10, 1, new_storage(), &l);
r.remove_node(2)?;
assert_eq!(r.prs().voter_ids().iter().next().unwrap(), &1);
// remove all nodes from cluster
r.remove_node(1)?;
assert!(r.prs().voter_ids().is_empty());
Ok(())
} | rust_cleaned_test_functions.jsonl/30309 | {
"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,
18193,
5084,
368,
1464,
5714,
71698,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
1125,
220,
16,
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... | 3 |
#[test]
fn test_parse_qos_at_least_once() {
let input_qos = "1";
let expected_qos = QoS::AtLeastOnce;
assert_eq!(parse_qos(input_qos).unwrap(), expected_qos);
} | rust_cleaned_test_functions.jsonl/15143 | {
"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,
21039,
78960,
3752,
88716,
7630,
368,
341,
286,
1077,
1946,
78960,
284,
330,
16,
876,
286,
1077,
3601,
78960,
284,
1207,
72743,
486,
1655,
81816,
12522,
280,
286,
2060,
10714,
10297,
6400,
78960,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_signature_rsa_pkcs1_sign_blinding_reuse() {
const MESSAGE: &'static [u8] = b"hello, world";
let rng = rand::SystemRandom::new();
const PRIVATE_KEY_DER: &'static [u8] =
include_bytes!("signature_rsa_example_private_key.der");
let key_bytes_der = untrusted::Input::from(PRIVATE_KEY_DER);
let key_pair = signature::RSAKeyPair::from_der(key_bytes_der).unwrap();
let key_pair = std::sync::Arc::new(key_pair);
let mut signature = vec![0; key_pair.public_modulus_len()];
let mut signing_state =
signature::RSASigningState::new(key_pair).unwrap();
for _ in 0..(blinding::REMAINING_MAX + 1) {
let prev_remaining = signing_state.blinding.remaining();
let _ = signing_state.sign(&signature::RSA_PKCS1_SHA256, &rng,
MESSAGE, &mut signature);
let remaining = signing_state.blinding.remaining();
assert_eq!((remaining + 1) % blinding::REMAINING_MAX,
prev_remaining);
}
} | rust_cleaned_test_functions.jsonl/89883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 538
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39859,
82522,
33321,
4837,
16,
11172,
13141,
3961,
1288,
810,
368,
341,
286,
733,
40758,
25,
30136,
1978,
508,
84,
23,
60,
284,
293,
1,
14990,
11,
1879,
876,
286,
1077,
28422,
284,
10382,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_g1_projective_group() {
let a: G1Projective = rand::random();
let b: G1Projective = rand::random();
group_test(a, b);
} | rust_cleaned_test_functions.jsonl/52491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
16,
16352,
533,
6288,
368,
341,
262,
1077,
264,
25,
479,
16,
7849,
533,
284,
10382,
486,
11463,
543,
262,
1077,
293,
25,
479,
16,
7849,
533,
284,
10382,
486,
11463,
543,
262,
1874,
4452,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_path_single() {
let mut router = Router::<()>::default();
router.register_resource(Resource::new(ResourceDef::new("/{value}/")));
let req = TestRequest::with_uri("/32/").finish();
let info = router.recognize(&req, &(), 0);
let req = req.with_route_info(info);
assert_eq!(*Path::<i8>::from_request(&req, &&PathConfig::default()).unwrap(), 32);
} | rust_cleaned_test_functions.jsonl/46188 | {
"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,
39123,
2638,
19487,
368,
341,
286,
1077,
5206,
9273,
284,
10554,
27638,
368,
6831,
2258,
543,
286,
9273,
9929,
17962,
40071,
486,
931,
40071,
2620,
486,
931,
65871,
957,
4472,
74385,
286,
1077,
42... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_custom_header_gets_indexed() {
let mut encoder: Encoder = Encoder::new();
let headers = vec![(b"custom-key".to_vec(), b"custom-value".to_vec())];
let result = encoder.encode_for_test(headers.iter().map(|h| (&h.0[..], &h.1[..])));
assert!(is_decodable(&result, &headers));
// The header is in the encoder's dynamic table.
assert_eq!(encoder.header_table.dynamic_table.to_vec_of_vec(), headers);
assert!(0x40 == (0x40 & result[0]));
debug!("{:?}", result);
} | rust_cleaned_test_functions.jsonl/121974 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15875,
8757,
3062,
82,
3560,
291,
368,
341,
286,
1077,
5206,
23668,
25,
55115,
284,
55115,
486,
931,
543,
286,
1077,
7102,
284,
7486,
0,
9697,
65,
1,
9163,
16173,
3263,
983,
13251,
1507,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_struct_pub_crate_visibility() {
check_assist(
extract_struct_from_enum_variant,
"pub(crate) enum A { $0One{ a: u32, b: u32, c: u32 } }",
r#"
pub(crate) struct One{ pub(crate) a: u32, pub(crate) b: u32, pub(crate) c: u32 }
pub(crate) enum A { One(One) }"#,
);
} | rust_cleaned_test_functions.jsonl/36308 | {
"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,
39123,
15126,
34014,
666,
7698,
71256,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8649,
15126,
5673,
31054,
46112,
345,
310,
330,
9585,
54907,
8,
7618,
362,
314,
400,
15,
3966,
90,
264,
25,
575... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_projective_addition() {
{
let a = G1Projective::identity();
let b = G1Projective::identity();
let c = a + b;
assert_eq!(c.is_identity().unwrap_u8(), 1);
assert_eq!(c.is_on_curve().unwrap_u8(), 1);
}
{
let a = G1Projective::identity();
let mut b = G1Projective::generator();
{
let z = Fp::from_raw_unchecked([
to_limb(0xba7afa1f9a6fe250),
to_limb(0xfa0f5b595eafe731),
to_limb(0x3bdc477694c306e7),
to_limb(0x2149be4b3949fa24),
to_limb(0x64aa6e0649b2078c),
to_limb(0x12b108ac33643c3e),
]);
let z2 = z.square();
b = G1Projective::from_raw_unchecked(b.x() * (z2), b.y() * (z2 * z), z);
}
let c = a + b;
assert_eq!(c.is_identity().unwrap_u8(), 0);
assert_eq!(c.is_on_curve().unwrap_u8(), 1);
assert_eq!(c, G1Projective::generator());
}
{
let a = G1Projective::identity();
let mut b = G1Projective::generator();
{
let z = Fp::from_raw_unchecked([
to_limb(0xba7afa1f9a6fe250),
to_limb(0xfa0f5b595eafe731),
to_limb(0x3bdc477694c306e7),
to_limb(0x2149be4b3949fa24),
to_limb(0x64aa6e0649b2078c),
to_limb(0x12b108ac33643c3e),
]);
let z2 = z.square();
b = G1Projective::from_raw_unchecked(b.x() * (z2), b.y() * (z2 * z), z);
}
let c = b + a;
assert_eq!(c.is_identity().unwrap_u8(), 0);
assert_eq!(c.is_on_curve().unwrap_u8(), 1);
assert_eq!(c, G1Projective::generator());
}
{
let a = G1Projective::generator().double().double(); // 4P
let b = G1Projective::generator().double(); // 2P
let c = a + b;
let mut d = G1Projective::generator();
for _ in 0..5 {
d += G1Projective::generator();
}
assert_eq!(c.is_identity().unwrap_u8(), 0);
assert_eq!(c.is_on_curve().unwrap_u8(), 1);
assert_eq!(d.is_identity().unwrap_u8(), 0);
assert_eq!(d.is_on_curve().unwrap_u8(), 1);
assert_eq!(c, d);
}
// Degenerate case
{
let mut beta = Fp::from_raw_unchecked([
to_limb(0xcd03c9e48671f071),
to_limb(0x5dab22461fcda5d2),
to_limb(0x587042afd3851b95),
to_limb(0x8eb60ebe01bacb9e),
to_limb(0x3f97d6e83d050d2),
to_limb(0x18f0206554638741),
]);
beta = beta.square();
let a = G1Projective::generator().double().double();
let b = G1Projective::from_raw_unchecked(a.x() * beta, -a.y(), a.z());
assert_eq!(a.is_on_curve().unwrap_u8(), 1);
assert_eq!(b.is_on_curve().unwrap_u8(), 1);
let c = a + b;
assert_eq!(
G1Affine::from(c),
G1Affine::from(G1Projective::from_raw_unchecked(
Fp::from_raw_unchecked([
to_limb(0x29e1e987ef68f2d0),
to_limb(0xc5f3ec531db03233),
to_limb(0xacd6c4b6ca19730f),
to_limb(0x18ad9e827bc2bab7),
to_limb(0x46e3b2c5785cc7a9),
to_limb(0x7e571d42d22ddd6),
]),
Fp::from_raw_unchecked([
to_limb(0x94d117a7e5a539e7),
to_limb(0x8e17ef673d4b5d22),
to_limb(0x9d746aaf508a33ea),
to_limb(0x8c6d883d2516c9a2),
to_limb(0xbc3b8d5fb0447f7),
to_limb(0x7bfa4c7210f4f44),
]),
Fp::one(),
))
);
assert_eq!(c.is_identity().unwrap_u8(), 0);
assert_eq!(c.is_on_curve().unwrap_u8(), 1);
}
} | rust_cleaned_test_functions.jsonl/10316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2873
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16352,
533,
2891,
680,
368,
341,
286,
341,
310,
1077,
264,
284,
479,
16,
7849,
533,
486,
16912,
543,
310,
1077,
293,
284,
479,
16,
7849,
533,
486,
16912,
543,
310,
1077,
272,
284,
264,
488,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_query_matches_with_many_results() {
allocations::record(|| {
let language = get_language("javascript");
let query = Query::new(language, "(array (identifier) @element)").unwrap();
assert_query_matches(
language,
&query,
&"[hello];\n".repeat(50),
&vec![(0, vec![("element", "hello")]); 50],
);
});
} | rust_cleaned_test_functions.jsonl/25151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
38344,
6615,
22101,
13576,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
14073,
797,
286,
1077,
3239,
284,
11361,
486,
931,
60740,
11,
11993,
1653,
320,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_accountsdb_remove_zero_balance_accounts() {
solana_logger::setup();
let key = Pubkey::new_unique();
let hash = Hash::new_unique();
let mut account_maps = Vec::new();
let val = CalculateHashIntermediate::new(hash, 1, key);
account_maps.push(val.clone());
let result = test_de_dup_accounts_in_parallel(&account_maps[..]);
assert_eq!(result, (vec![val.hash], val.lamports as u64, 1));
let val = CalculateHashIntermediate::new(hash, ZERO_RAW_LAMPORTS_SENTINEL, key);
account_maps.push(val); // has to be after previous entry since account_maps are in slot order
let result = test_de_dup_accounts_in_parallel(&account_maps[..]);
assert_eq!(result, (vec![], 0, 2));
} | rust_cleaned_test_functions.jsonl/94722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
18193,
19359,
29396,
55665,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
1376,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
5175,
284,
6531,
486,
931,
21218,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul() {
let (mut a, my_env) = test_env();
let pair = new_apply(new_apply(new_identifier("pair"),
new_apply(new_identifier("f"),
new_identifier("4"))),
new_apply(new_identifier("f"),
new_identifier("true")));
let syntax = new_let("f", new_lambda("x", new_identifier("x")), pair);
let t = analyse(&mut a, &syntax, &my_env, &hashset![]);
assert_eq!(a[t].as_string(&a, &mut Namer {
value: 'a',
set: hashmap![],
}), r#"(int * bool)"#);
} | rust_cleaned_test_functions.jsonl/127653 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
368,
341,
262,
1077,
320,
6984,
264,
11,
847,
15879,
8,
284,
1273,
15879,
1428,
262,
1077,
6716,
284,
501,
36551,
1755,
36551,
1755,
33176,
445,
12670,
4461,
5180,
501,
36551,
1755,
33176,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_download_flist() -> Result<()> {
let repo = Repo::new(String::from("azmy"));
let flist = repo.get("test.flist")?;
let temp = "/tmp/hub-download-test.flist";
flist.download(temp)?;
// comput hash sum of the downloaded file
// and compare it with flist hash info
use std::process::Command;
let output = Command::new("md5sum").arg(temp).output()?;
let output = String::from_utf8(output.stdout)?;
let line: Vec<&str> = output.split_whitespace().collect();
assert_eq!(line[0], &flist.md5);
let _ = std::fs::remove_file(temp);
Ok(())
} | rust_cleaned_test_functions.jsonl/47565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35939,
761,
1607,
368,
1464,
5714,
71698,
341,
286,
1077,
15867,
284,
71509,
486,
931,
2242,
486,
1499,
445,
1370,
2408,
4010,
286,
1077,
1320,
380,
284,
15867,
670,
445,
1944,
833,
1607,
899,
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... | 5 |
#[test]
fn test_timed_binary() {
let spec = "output o1: Bool @10Hz:= false\noutput o2: Bool @10Hz:= o1 && true";
assert_eq!(0, num_type_errors(spec));
} | rust_cleaned_test_functions.jsonl/110702 | {
"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,
29087,
291,
31761,
368,
341,
286,
1077,
1398,
284,
330,
3006,
297,
16,
25,
12608,
569,
16,
15,
11475,
14209,
895,
1699,
3006,
297,
17,
25,
12608,
569,
16,
15,
11475,
14209,
297,
16,
1009,
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 |
#[test]
fn test_lint_unreachable() {
let m = module(
r#"
def test():
return 1
no1
def test2():
if x:
return 1
yes
def test3():
if x:
return
else:
return
no2
ignored
def test4():
for x in xs:
continue
no3
reachable
def test5():
for x in xs:
if test:
continue
reachable
return
reachable
def test6():
fail(1)
no4
def f():
def g():
return 5
reachable
"#,
);
let mut res = Vec::new();
reachable(&m.codemap, &m.statement, &mut res);
assert_eq!(
res.map(|x| x.problem.about()),
&["no1", "no2", "no3", "no4"]
);
} | rust_cleaned_test_functions.jsonl/6152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
396,
4907,
46550,
368,
341,
286,
1077,
296,
284,
4688,
1006,
310,
435,
2,
698,
750,
1273,
3932,
262,
470,
220,
16,
198,
262,
902,
16,
198,
750,
1273,
17,
3932,
262,
421,
856,
510,
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_params() {
#[api_v2_schema]
#[derive(Deserialize)]
struct KnownResourceBadge {
resource: String,
name: String,
}
#[api_v2_schema]
#[derive(Deserialize)]
struct BadgeParams {
res: Option<u16>,
color: String,
}
#[api_v2_schema]
#[derive(Deserialize)]
struct BadgeBody {
data: String,
}
#[api_v2_operation]
fn get_resource_2(_p: web::Path<String>) -> String {
unimplemented!();
}
#[api_v2_operation]
fn get_known_badge_1(_p: web::Path<KnownResourceBadge>, _q: web::Query<BadgeParams>) -> String {
unimplemented!();
}
#[api_v2_operation]
fn get_known_badge_2(_p: web::Path<(String, String)>, _q: web::Query<BadgeParams>) -> String {
unimplemented!();
}
#[api_v2_operation]
fn post_badge_1(
_p: web::Path<KnownResourceBadge>,
_q: web::Query<BadgeParams>,
_f: web::Form<BadgeBody>,
) -> String {
unimplemented!();
}
#[api_v2_operation]
fn post_badge_2(_p: web::Path<(String, String)>, _b: web::Json<BadgeBody>) -> String {
unimplemented!();
}
run_and_check_app(
|| {
App::new()
.wrap_api()
.with_json_spec_at("/api/spec")
.service(
web::scope("/api")
.service(
web::resource("/v1/{resource}/v/{name}")
.route(web::Route::new().to(get_known_badge_1))
.route(web::post().to(post_badge_1)),
)
.service(
web::resource("/v2/{resource}/v/{name}")
.route(web::get().to(get_known_badge_2))
.route(web::post().to(post_badge_2)),
)
.service(
web::resource("/v2/{resource}").route(web::get().to(get_resource_2)),
),
)
.build()
},
|addr| {
let mut resp = CLIENT
.get(&format!("http://{}/api/spec", addr))
.send()
.expect("request failed?");
check_json(
&mut resp,
json!({
"definitions": {
"BadgeBody": {
"properties": {
"data": {
"type": "string"
}
},
"required":["data"]
}
},
"paths": {
"/api/v1/{resource}/v/{name}": {
"delete": {
"responses": {}
},
"get": {
"responses": {}
},
"head": {
"responses": {}
},
"options": {
"responses": {}
},
"parameters": [{
"in": "query",
"name": "color",
"required": true,
"type": "string"
}, {
"in": "path",
"name": "name",
"required": true,
"type": "string"
}, {
"format": "int32",
"in": "query",
"name": "res",
"type": "integer"
}, {
"in": "path",
"name": "resource",
"required": true,
"type": "string"
}],
"patch": {
"responses": {}
},
"post": {
"parameters": [{
"in": "formData",
"name": "data",
"required": true,
"type": "string"
}],
"responses": {}
},
"put": {
"responses": {}
}
},
"/api/v2/{resource}": {
"get": {
"responses": {}
},
"parameters": [{
"in": "path",
"name": "resource",
"required": true,
"type": "string"
}]
},
"/api/v2/{resource}/v/{name}": {
"get": {
"parameters": [{
"in": "query",
"name": "color",
"required": true,
"type": "string"
}, {
"format": "int32",
"in": "query",
"name": "res",
"type": "integer"
}],
"responses": {}
},
"parameters": [{
"in": "path",
"name": "name",
"required": true,
"type": "string"
}, {
"in": "path",
"name": "resource",
"required": true,
"type": "string"
}],
"post": {
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/BadgeBody"
}
}],
"responses": {}
}
}
},
"swagger": "2.0"
}),
);
},
);
} | rust_cleaned_test_functions.jsonl/95582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4591
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6745,
368,
341,
262,
11506,
2068,
2273,
17,
25371,
921,
262,
11506,
27098,
7,
64465,
5563,
262,
2036,
48286,
4783,
56054,
341,
286,
5101,
25,
923,
345,
286,
829,
25,
923,
345,
262,
555,
262,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_triangulate() {
let points = [[1, -1], [1, 1], [-1, 1], [-1, -1]];
let tgs = triangulate(&points);
assert_eq!(tgs, [0, 1, 2, 0, 2, 3]);
} | rust_cleaned_test_functions.jsonl/49804 | {
"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,
3547,
27224,
6334,
368,
341,
262,
1077,
3501,
284,
4318,
16,
11,
481,
16,
1125,
508,
16,
11,
220,
16,
1125,
10055,
16,
11,
220,
16,
1125,
10055,
16,
11,
481,
16,
13204,
262,
1077,
259,
5857,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_store_instruction() {
let mut data = [4u8; 10];
store_current_index(&mut data, 3);
#[allow(deprecated)]
let index = load_current_index(&data);
assert_eq!(index, 3);
assert_eq!([4u8; 8], data[0..8]);
} | rust_cleaned_test_functions.jsonl/78024 | {
"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,
12411,
14809,
54923,
368,
341,
286,
1077,
5206,
821,
284,
508,
19,
84,
23,
26,
220,
16,
15,
935,
286,
3553,
11080,
3560,
2099,
6984,
821,
11,
220,
18,
317,
286,
11506,
7183,
12797,
19889,
5563... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_deserialize_str() {
let expected = RpcResponse {
id: JsonId::StrId(String::from("1")),
method: String::from("login"),
jsonrpc: String::from("2.0"),
result: None,
error: None,
};
let json = r#"{"id":"1","method":"login","jsonrpc":"2.0","params":null}"#;
let serialized: RpcResponse = serde_json::from_str(json).unwrap();
assert_eq!(expected, serialized);
} | rust_cleaned_test_functions.jsonl/49210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9655,
15768,
9050,
2895,
368,
341,
197,
10217,
3601,
284,
79961,
2582,
341,
298,
15710,
25,
8308,
764,
486,
2580,
764,
2242,
486,
1499,
445,
16,
30154,
298,
42257,
25,
923,
486,
1499,
445,
3673,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gamepad_connected_event() {
let event: GamepadConnectedEvent = js!(
return new GamepadEvent("gamepadconnected");
).try_into().unwrap();
assert_eq!(event.event_type(), "gamepadconnected");
} | rust_cleaned_test_functions.jsonl/83265 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18547,
13242,
43276,
6748,
368,
1476,
286,
1077,
1538,
25,
4050,
13242,
21146,
1556,
284,
6994,
33673,
310,
470,
501,
4050,
13242,
1556,
445,
5804,
13242,
15288,
797,
286,
7457,
1539,
45514,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fold_bit_shifts_string_compare() {
fold("x = -1 << 1", "x = -2");
fold("x = -1 << 8", "x = -256");
fold("x = -1 >> 1", "x = -1");
fold("x = -2 >> 1", "x = -1");
fold("x = -1 >> 0", "x = -1");
} | rust_cleaned_test_functions.jsonl/122179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
13996,
22230,
82,
3904,
32235,
368,
341,
262,
11555,
445,
87,
284,
481,
16,
1115,
220,
16,
497,
330,
87,
284,
481,
17,
797,
262,
11555,
445,
87,
284,
481,
16,
1115,
220,
23,
497,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_day09_p1() {
let t: &[i64] = &DAY9;
let mut vm = Vm::new(Vec::from(t), vec![1], InputMode::VecDirect, OutputMode::No);
vm.run();
assert_eq!(vm.output.len(), 1);
assert_eq!(vm.output[0], 4080871669);
} | rust_cleaned_test_functions.jsonl/56171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16763,
15,
24,
620,
16,
368,
341,
286,
1077,
259,
25,
44590,
72,
21,
19,
60,
284,
609,
33112,
24,
280,
286,
1077,
5206,
10995,
284,
647,
76,
486,
931,
49923,
486,
1499,
1155,
701,
7486,
2070... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_json_and_bad_custom_content_type() {
let (req, mut pl) = TestRequest::with_header(
header::CONTENT_TYPE,
header::HeaderValue::from_static("text/html"),
)
.header(
header::CONTENT_LENGTH,
header::HeaderValue::from_static("16"),
)
.set_payload(Bytes::from_static(b"{\"name\": \"test\"}"))
.data(JsonConfig::default().content_type(|mime: mime::Mime| {
mime.type_() == mime::TEXT && mime.subtype() == mime::PLAIN
}))
.to_http_parts();
let s = block_on(Json::<MyObject>::from_request(&req, &mut pl));
assert!(s.is_err())
} | rust_cleaned_test_functions.jsonl/37464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
9455,
8378,
34199,
15875,
7495,
1819,
368,
341,
286,
1077,
320,
2958,
11,
5206,
625,
8,
284,
3393,
1900,
486,
4197,
8757,
1006,
310,
4247,
486,
67872,
4189,
345,
310,
4247,
486,
97721,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_arena_allocate_slice() {
let mut arena = MemoryArena::new();
let a = b"hello";
let b = b"happy tax payer";
let addr_a = arena.allocate_space(a.len());
arena.slice_mut(addr_a, a.len()).copy_from_slice(a);
let addr_b = arena.allocate_space(b.len());
arena.slice_mut(addr_b, b.len()).copy_from_slice(b);
assert_eq!(arena.slice(addr_a, a.len()), a);
assert_eq!(arena.slice(addr_b, b.len()), b);
} | rust_cleaned_test_functions.jsonl/15365 | {
"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,
62,
30527,
77078,
26488,
368,
341,
286,
1077,
5206,
24902,
284,
13850,
93937,
486,
931,
543,
286,
1077,
264,
284,
293,
1,
14990,
876,
286,
1077,
293,
284,
293,
1,
56521,
3742,
69275,
3302,
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_windows_10() {
let mut os = OsContext {
raw_description: "Microsoft Windows 10.0.16299".to_string().into(),
..OsContext::default()
};
normalize_os_context(&mut os);
assert_eq_dbg!(Some("Windows"), os.name.as_str());
assert_eq_dbg!(Some("10.0.16299"), os.version.as_str());
} | rust_cleaned_test_functions.jsonl/68954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58220,
62,
16,
15,
368,
341,
9401,
262,
1077,
5206,
2643,
284,
15433,
1972,
341,
286,
7112,
11448,
25,
330,
12778,
5515,
220,
16,
15,
13,
15,
13,
16,
21,
17,
24,
24,
3263,
983,
3904,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strip_shebang() {
let value =
"#!/usr/bin/env deno\n\nconsole.log(\"hello deno!\");\n".to_string();
assert_eq!(strip_shebang(value), "\n\nconsole.log(\"hello deno!\");\n");
} | rust_cleaned_test_functions.jsonl/32456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66130,
643,
383,
27174,
368,
341,
262,
1077,
897,
4035,
414,
5869,
87980,
7063,
8749,
14358,
3371,
78,
1699,
1699,
5354,
1665,
36014,
14990,
3371,
78,
14771,
5038,
59,
77,
3263,
983,
3904,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_css_simple_selector_parse() {
use self::CssPathSelector::*;
use azul_css::NodeTypePath;
let css = "div#id.my_class > p .new { }";
let parsed = vec![
Type(NodeTypePath::Div),
Id("id".into()),
Class("my_class".into()),
DirectChildren,
Type(NodeTypePath::P),
Children,
Class("new".into())
];
assert_eq!(new_from_str(css).unwrap(), Css {
rules: vec![CssRuleBlock {
path: CssPath { selectors: parsed },
declarations: Vec::new(),
}],
});
} | rust_cleaned_test_functions.jsonl/79851 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25924,
30015,
28890,
21039,
368,
972,
262,
990,
656,
486,
40275,
1820,
5877,
34076,
463,
262,
990,
12376,
360,
25924,
486,
66137,
1820,
463,
262,
1077,
15877,
284,
330,
611,
2,
307,
12618,
4790,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_data_mic_when_type_not_ok() {
let bytes = [0; 23];
let phy = PhyPayload::new(&bytes[..]);
let key = AES128([2; 16]);
assert!(phy.is_ok());
assert_eq!(
phy.unwrap().validate_data_mic(&key, 1),
Err("Could not read mac payload, maybe of incorrect type")
);
} | rust_cleaned_test_functions.jsonl/81603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
1769,
717,
292,
47636,
1819,
7913,
19817,
368,
341,
262,
1077,
5820,
284,
508,
15,
26,
220,
17,
18,
935,
262,
1077,
36455,
284,
92582,
29683,
486,
931,
2099,
9651,
95874,
2558,
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_and_with_multiple_neq_parse() {
let name1 = _random_string(10);
let value1 = _random_string(10);
let name2 = _random_string(10);
let value2 = _random_string(10);
let name3 = _random_string(10);
let value3 = _random_string(10);
let json = format!(r#"{{"$and":[{{"~{}":{{"$neq":"{}"}}}},{{"~{}":{{"$neq":"{}"}}}},{{"~{}":{{"$neq":"{}"}}}}]}}"#,
name1, value1,
name2, value2,
name3, value3,
);
let query = parse_from_json(&json).unwrap();
let expected = Operator::And(
vec![
Operator::Neq(
TagName::PlainTagName(name1.to_vec()),
TargetValue::Unencrypted(value1.clone())
),
Operator::Neq(
TagName::PlainTagName(name2.to_vec()),
TargetValue::Unencrypted(value2.clone())
),
Operator::Neq(
TagName::PlainTagName(name3.to_vec()),
TargetValue::Unencrypted(value3.clone())
)
]
);
assert_eq!(query, expected);
} | rust_cleaned_test_functions.jsonl/11836 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 734
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8378,
6615,
45233,
13925,
80,
21039,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
829,
17,
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_highpass() {
let mut hp = HighPass::new(440.0, 1.0);
run_modifier(&mut hp, "highpass.wav");
} | rust_cleaned_test_functions.jsonl/67276 | {
"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,
22680,
6385,
368,
341,
286,
1077,
5206,
20630,
284,
5124,
12187,
486,
931,
7,
19,
19,
15,
13,
15,
11,
220,
16,
13,
15,
626,
286,
1598,
61773,
2099,
6984,
20630,
11,
330,
11892,
6385,
29864,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_negated_number_plus_positive_number() {
assert_expression!(
"-5 + 2",
Expression::BinaryExpression(
Operator::Plus,
Box::new((-5_i32).as_lit_expr(1, 7)),
Box::new(2.as_lit_expr(1, 12)),
ExpressionType::Unresolved
)
);
} | rust_cleaned_test_functions.jsonl/102658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
657,
5500,
28043,
54160,
5500,
368,
341,
310,
2060,
28068,
33673,
394,
6523,
20,
488,
220,
17,
756,
394,
16378,
486,
21338,
9595,
1006,
503,
28498,
486,
21807,
345,
503,
8261,
486,
931,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uuid() {
let a: StringArray =
vec![Some("err"), Some("612f3c40-5d3b-217e-707b-6a546a3d7b29")].into();
let a = Arc::new(a);
assert!(utf8_to_uuid_or_error(&[a.clone()]).is_err());
let b = utf8_to_uuid_or_null(&[a.clone()]).unwrap();
assert!(b.is_null(0));
assert_eq!(b"a/<@];!~p{jTj={)", b.value(1));
let b = utf8_to_uuid_or_zero(&[a.clone()]).unwrap();
assert_eq!(&[0; 16], b.value(0));
assert_eq!(b"a/<@];!~p{jTj={)", b.value(1));
let a: LargeStringArray = vec![
Some("\u{3}err"),
Some("\u{24}612f3c40-5d3b-217e-707b-6a546a3d7b29"),
]
.into();
let a = Arc::new(a);
assert!(large_utf8_to_uuid_or_error(&[a.clone()]).is_err());
let b = large_utf8_to_uuid_or_null(&[a.clone()]).unwrap();
assert!(b.is_null(0));
assert_eq!(b"a/<@];!~p{jTj={)", b.value(1));
let b = large_utf8_to_uuid_or_zero(&[a.clone()]).unwrap();
assert_eq!(&[0; 16], b.value(0));
assert_eq!(b"a/<@];!~p{jTj={)", b.value(1));
// utf8 to uuid
let a: StringArray = vec![Some("612f3c40-5d3b-217e-707b-6a546a3d7b29")].into();
let a = Arc::new(a);
let b = utf8_to_uuid_or_error(&[a]).unwrap();
assert_eq!(b"a/<@];!~p{jTj={)", b.value(0));
// large utf8 to uuid
let a: LargeStringArray =
vec![Some("\u{24}612f3c40-5d3b-217e-707b-6a546a3d7b29")].into();
let a = Arc::new(a);
let b = large_utf8_to_uuid_or_error(&[a]).unwrap();
assert_eq!(b"a/<@];!~p{jTj={)", b.value(0));
// uuid to large utf8
let a =
FixedSizeBinaryArray::try_from_iter(vec![b"a/<@];!~p{jTj={)"].into_iter())
.unwrap();
let b = uuid_to_large_utf(&a).unwrap();
assert_eq!("\u{24}612f3c40-5d3b-217e-707b-6a546a3d7b29", b.value(0));
} | rust_cleaned_test_functions.jsonl/109391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25540,
368,
341,
1789,
286,
1077,
264,
25,
923,
1857,
4035,
310,
7486,
20703,
8373,
445,
615,
3975,
4329,
445,
21,
16,
17,
69,
18,
66,
19,
15,
12,
20,
67,
18,
65,
12,
17,
16,
22,
68,
12,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_long_to_double() {
assert_less(Variant::from(1_i64), Variant::from(2.0));
assert_equal(Variant::from(3_i64), Variant::from(3.0));
assert_greater(Variant::from(5_i64), Variant::from(4.0));
} | rust_cleaned_test_functions.jsonl/84525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
2346,
24598,
368,
341,
310,
2060,
50747,
12410,
15341,
486,
1499,
7,
16,
5318,
21,
19,
701,
39292,
486,
1499,
7,
17,
13,
15,
1106,
310,
2060,
11478,
12410,
15341,
486,
1499,
7,
18,
5318... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_append_block_with_duplicate_output_public_key() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let mut ledger_db = create_db();
// Write a block to the ledger.
let origin_account_key = AccountKey::random(&mut rng);
let (origin_block, origin_block_contents) =
get_origin_block_and_contents(&origin_account_key);
ledger_db
.append_block(&origin_block, &origin_block_contents, None)
.unwrap();
// The next block reuses a public key.
let existing_tx_out = ledger_db.get_tx_out_by_index(0).unwrap();
let account_key = AccountKey::random(&mut rng);
let block_one_contents = {
let mut tx_out = TxOut::new(
33,
&account_key.default_subaddress(),
&RistrettoPrivate::from_random(&mut rng),
Default::default(),
)
.unwrap();
tx_out.public_key = existing_tx_out.public_key.clone();
let outputs = vec![tx_out];
BlockContents::new(vec![KeyImage::from(rng.next_u64())], outputs)
};
let block_one = Block::new_with_parent(
BLOCK_VERSION,
&origin_block,
&Default::default(),
&block_one_contents,
);
assert_eq!(
ledger_db.append_block(&block_one, &block_one_contents, None),
Err(Error::DuplicateOutputPublicKey)
);
} | rust_cleaned_test_functions.jsonl/89701 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 754
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
7113,
6615,
70434,
7645,
27074,
3097,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17,
2558,
286,
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_hash_value_iter_bits() {
let hash = b"hello".test_only_hash();
let bits = hash.iter_bits().collect::<Vec<_>>();
assert_eq!(bits.len(), HashValue::LENGTH_IN_BITS);
assert_eq!(bits[0], false);
assert_eq!(bits[1], false);
assert_eq!(bits[2], true);
assert_eq!(bits[3], true);
assert_eq!(bits[4], false);
assert_eq!(bits[5], false);
assert_eq!(bits[6], true);
assert_eq!(bits[7], true);
assert_eq!(bits[248], true);
assert_eq!(bits[249], false);
assert_eq!(bits[250], false);
assert_eq!(bits[251], true);
assert_eq!(bits[252], false);
assert_eq!(bits[253], false);
assert_eq!(bits[254], true);
assert_eq!(bits[255], false);
let mut bits_rev = hash.iter_bits().rev().collect::<Vec<_>>();
bits_rev.reverse();
assert_eq!(bits, bits_rev);
} | rust_cleaned_test_functions.jsonl/118038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
3142,
11723,
20034,
368,
341,
262,
1077,
5175,
284,
293,
1,
14990,
3263,
1944,
18410,
8950,
543,
262,
1077,
9472,
284,
5175,
19471,
20034,
1005,
17384,
27638,
10050,
32399,
79279,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fifo_error_reference_and_size() {
let (at, mut ucmd) = at_and_ucmd!();
at.mkfifo("fifo");
at.make_file("reference_file");
ucmd.args(&["-r", "reference_file", "-s", "+0", "fifo"])
.fails()
.no_stdout()
.stderr_contains("cannot open 'fifo' for writing: No such device or address");
} | rust_cleaned_test_functions.jsonl/77107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56590,
4096,
25433,
8378,
2368,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
518,
35011,
74031,
445,
74031,
797,
262,
518,
10117,
2458,
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_v8_set_flags_preprocess_1() {
let js_args = v8_set_flags_preprocess(vec![
"deno".to_string(),
"--v8-options".to_string(),
]);
assert_eq!(
js_args,
(vec!["deno".to_string(), "--help".to_string()], vec![])
);
} | rust_cleaned_test_functions.jsonl/110203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
23,
2602,
14130,
10442,
4630,
62,
16,
368,
341,
220,
1077,
6994,
8384,
284,
348,
23,
2602,
14130,
10442,
4630,
25592,
90515,
262,
330,
5183,
78,
3263,
983,
3904,
3148,
262,
14482,
85,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hello() {
assert!(Solution::backspace_compare(
"ab#c".to_string(),
"ad#c".to_string()
));
assert!(Solution::backspace_compare(
"ab##".to_string(),
"c#d#".to_string()
));
assert!(Solution::backspace_compare(
"a##c".to_string(),
"#a#c".to_string()
));
assert!(!Solution::backspace_compare(
"a#c".to_string(),
"b".to_string()
));
} | rust_cleaned_test_functions.jsonl/57075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96724,
368,
341,
286,
2060,
10297,
36842,
486,
1419,
8746,
32235,
1006,
310,
330,
370,
92253,
3263,
983,
3904,
3148,
310,
330,
329,
92253,
3263,
983,
3904,
741,
286,
16518,
286,
2060,
10297,
36842... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_next_lower_pmtu_plateau() {
assert_eq!(next_lower_pmtu_plateau(65536).unwrap(), 65535);
assert_eq!(next_lower_pmtu_plateau(65535).unwrap(), 32000);
assert_eq!(next_lower_pmtu_plateau(65534).unwrap(), 32000);
assert_eq!(next_lower_pmtu_plateau(32001).unwrap(), 32000);
assert_eq!(next_lower_pmtu_plateau(32000).unwrap(), 17914);
assert_eq!(next_lower_pmtu_plateau(31999).unwrap(), 17914);
assert_eq!(next_lower_pmtu_plateau(1281).unwrap(), 1280);
assert_eq!(next_lower_pmtu_plateau(1280).unwrap(), 1006);
assert_eq!(next_lower_pmtu_plateau(69).unwrap(), 68);
assert_eq!(next_lower_pmtu_plateau(68), None);
assert_eq!(next_lower_pmtu_plateau(67), None);
assert_eq!(next_lower_pmtu_plateau(0), None);
} | rust_cleaned_test_functions.jsonl/59723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 396
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
30425,
620,
2501,
84,
79366,
2863,
368,
341,
286,
2060,
10714,
10297,
3600,
30425,
620,
2501,
84,
79366,
2863,
7,
21,
20,
20,
18,
21,
568,
15454,
1507,
220,
21,
20,
20,
18,
20,
317,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde() {
let vec = vec![(1, 2), (3, 4), (5, 6)];
let slab: Slab<_> = vec.iter().cloned().collect();
assert_tokens(
&SlabPartialEq(slab),
&[
Token::Map { len: Some(3) },
Token::U64(1),
Token::I32(2),
Token::U64(3),
Token::I32(4),
Token::U64(5),
Token::I32(6),
Token::MapEnd,
],
);
} | rust_cleaned_test_functions.jsonl/83196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
368,
341,
262,
1077,
7486,
284,
7486,
0,
9697,
16,
11,
220,
17,
701,
320,
18,
11,
220,
19,
701,
320,
20,
11,
220,
21,
12587,
262,
1077,
54691,
25,
6852,
370,
32399,
29,
284,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.