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_new_vote() {
let local = VoteState::default();
let vote = Tower::new_vote(&local, 0, Hash::default(), None);
assert_eq!(local.votes.len(), 0);
assert_eq!(vote.0.slots, vec![0]);
assert_eq!(vote.1, 0);
} | rust_cleaned_test_functions.jsonl/77041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
54360,
368,
341,
286,
1077,
2205,
284,
34034,
1397,
486,
2258,
543,
286,
1077,
6910,
284,
21938,
486,
931,
54360,
2099,
2438,
11,
220,
15,
11,
6531,
486,
2258,
1507,
2240,
317,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_account_changes_executable() {
let owner = solana_sdk::pubkey::new_rand();
let mallory_program_id = solana_sdk::pubkey::new_rand();
let system_program_id = system_program::id();
assert_eq!(
Change::new(&owner, &system_program_id)
.executable(false, true)
.verify(),
Err(InstructionError::ExecutableModified),
"system program can't change executable if system doesn't own the account"
);
assert_eq!(
Change::new(&owner, &system_program_id)
.executable(true, true)
.data(vec![1], vec![2])
.verify(),
Err(InstructionError::ExecutableDataModified),
"system program can't change executable data if system doesn't own the account"
);
assert_eq!(
Change::new(&owner, &owner).executable(false, true).verify(),
Ok(()),
"owner should be able to change executable"
);
assert_eq!(
Change::new(&owner, &owner)
.executable(false, true)
.read_only()
.verify(),
Err(InstructionError::ExecutableModified),
"owner can't modify executable of read-only accounts"
);
assert_eq!(
Change::new(&owner, &owner).executable(true, false).verify(),
Err(InstructionError::ExecutableModified),
"owner program can't reverse executable"
);
assert_eq!(
Change::new(&owner, &mallory_program_id)
.executable(false, true)
.verify(),
Err(InstructionError::ExecutableModified),
"malicious Mallory should not be able to change the account executable"
);
assert_eq!(
Change::new(&owner, &owner)
.executable(false, true)
.data(vec![1], vec![2])
.verify(),
Ok(()),
"account data can change in the same instruction that sets the bit"
);
assert_eq!(
Change::new(&owner, &owner)
.executable(true, true)
.data(vec![1], vec![2])
.verify(),
Err(InstructionError::ExecutableDataModified),
"owner should not be able to change an account's data once its marked executable"
);
assert_eq!(
Change::new(&owner, &owner)
.executable(true, true)
.lamports(1, 2)
.verify(),
Err(InstructionError::ExecutableLamportChange),
"owner should not be able to add lamports once marked executable"
);
assert_eq!(
Change::new(&owner, &owner)
.executable(true, true)
.lamports(1, 2)
.verify(),
Err(InstructionError::ExecutableLamportChange),
"owner should not be able to add lamports once marked executable"
);
assert_eq!(
Change::new(&owner, &owner)
.executable(true, true)
.lamports(2, 1)
.verify(),
Err(InstructionError::ExecutableLamportChange),
"owner should not be able to subtract lamports once marked executable"
);
let data = vec![1; 100];
let min_lamports = Rent::default().minimum_balance(data.len());
assert_eq!(
Change::new(&owner, &owner)
.executable(false, true)
.lamports(0, min_lamports)
.data(data.clone(), data.clone())
.verify(),
Ok(()),
);
assert_eq!(
Change::new(&owner, &owner)
.executable(false, true)
.lamports(0, min_lamports - 1)
.data(data.clone(), data)
.verify(),
Err(InstructionError::ExecutableAccountNotRentExempt),
"owner should not be able to change an account's data once its marked executable"
);
} | rust_cleaned_test_functions.jsonl/15693 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
13500,
47526,
18430,
5922,
368,
341,
286,
1077,
6372,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
33253,
679,
25096,
842,
284,
2048,
3362,
61783,
486,
9585,
792... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sparse_trigger_sparse_to_normal() {
let builder = PassThroughHasherBuilder {};
let mut hll: HyperLogLogPlus<u64, PassThroughHasherBuilder> =
HyperLogLogPlus::new(4, builder).unwrap();
// We have 5 registers every 4 bytes
for i in 0u64..12 {
hll.add(&(1 << i));
}
assert!(hll.registers.is_none());
hll.add(&(1 << 13));
assert!(hll.registers.is_some());
assert_eq!(hll.tmpset.len(), 0);
assert_eq!(hll.sparse.len(), 0);
} | rust_cleaned_test_functions.jsonl/8346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71123,
32925,
71123,
2346,
13973,
368,
341,
286,
1077,
7363,
284,
9970,
23857,
6370,
261,
3297,
20375,
286,
1077,
5206,
305,
654,
25,
32732,
2201,
2201,
21807,
34837,
21,
19,
11,
9970,
23857,
6370... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_jeq_reg() {
test_interpreter_and_jit_asm!(
"
mov32 r0, 0
mov32 r1, 0xa
mov32 r2, 0xb
jeq r1, r2, +4
mov32 r0, 1
mov32 r1, 0xb
jeq r1, r2, +1
mov32 r0, 2
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x1 } },
8
);
} | rust_cleaned_test_functions.jsonl/59009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
3756,
80,
4920,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
18,
17,
435,
15,
11,
220,
15,
198,
286,
1974,
18,
17,
435,
16,
11,
220,
15,
9591,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_in() {
let dec1 = "1.1".parse::<Decimal>().unwrap();
let dec2 = "1.11".parse::<Decimal>().unwrap();
let dur1 = Duration::parse(b"01:00:00", 0).unwrap();
let dur2 = Duration::parse(b"02:00:00", 0).unwrap();
let json1 = Json::I64(11);
let json2 = Json::I64(12);
let s1 = "你好".as_bytes().to_owned();
let s2 = "你好啊".as_bytes().to_owned();
let t1 = Time::parse_utc_datetime("2012-12-12 12:00:39", 0).unwrap();
let t2 = Time::parse_utc_datetime("2012-12-12 13:00:39", 0).unwrap();
let cases = vec![
(
ScalarFuncSig::InInt,
vec![Datum::I64(1), Datum::I64(2)],
Datum::I64(0),
),
(
ScalarFuncSig::InInt,
vec![Datum::I64(1), Datum::I64(2), Datum::I64(1)],
Datum::I64(1),
),
(
ScalarFuncSig::InInt,
vec![Datum::I64(1), Datum::I64(2), Datum::Null],
Datum::Null,
),
(
ScalarFuncSig::InInt,
vec![Datum::I64(1), Datum::I64(2), Datum::Null, Datum::I64(1)],
Datum::I64(1),
),
(
ScalarFuncSig::InInt,
vec![Datum::Null, Datum::I64(2), Datum::I64(1)],
Datum::Null,
),
(
ScalarFuncSig::InReal,
vec![Datum::F64(3.1), Datum::F64(3.2), Datum::F64(3.3)],
Datum::I64(0),
),
(
ScalarFuncSig::InReal,
vec![Datum::F64(3.1), Datum::F64(3.2), Datum::F64(3.1)],
Datum::I64(1),
),
(
ScalarFuncSig::InDecimal,
vec![Datum::Dec(dec1.clone()), Datum::Dec(dec2.clone())],
Datum::I64(0),
),
(
ScalarFuncSig::InDecimal,
vec![
Datum::Dec(dec1.clone()),
Datum::Dec(dec2.clone()),
Datum::Dec(dec1.clone()),
],
Datum::I64(1),
),
(
ScalarFuncSig::InDuration,
vec![Datum::Dur(dur1), Datum::Dur(dur2)],
Datum::I64(0),
),
(
ScalarFuncSig::InDuration,
vec![Datum::Dur(dur1), Datum::Dur(dur2), Datum::Dur(dur1)],
Datum::I64(1),
),
(
ScalarFuncSig::InJson,
vec![Datum::Json(json1.clone()), Datum::Json(json2.clone())],
Datum::I64(0),
),
(
ScalarFuncSig::InJson,
vec![
Datum::Json(json1.clone()),
Datum::Json(json2.clone()),
Datum::Json(json1.clone()),
],
Datum::I64(1),
),
(
ScalarFuncSig::InString,
vec![Datum::Bytes(s1.clone()), Datum::Bytes(s2.clone())],
Datum::I64(0),
),
(
ScalarFuncSig::InString,
vec![
Datum::Bytes(s1.clone()),
Datum::Bytes(s2.clone()),
Datum::Bytes(s1.clone()),
],
Datum::I64(1),
),
(
ScalarFuncSig::InTime,
vec![Datum::Time(t1.clone()), Datum::Time(t2.clone())],
Datum::I64(0),
),
(
ScalarFuncSig::InTime,
vec![
Datum::Time(t1.clone()),
Datum::Time(t2.clone()),
Datum::Time(t1.clone()),
],
Datum::I64(1),
),
];
let mut ctx = EvalContext::default();
for (sig, row, exp) in cases {
let children: Vec<Expr> = (0..row.len()).map(|id| col_expr(id as i64)).collect();
let mut expr = Expr::default();
expr.set_tp(ExprType::ScalarFunc);
expr.set_sig(sig);
expr.set_children(children.into());
let e = Expression::build(&ctx, expr).unwrap();
let res = e.eval(&mut ctx, &row).unwrap();
assert_eq!(res, exp);
}
} | rust_cleaned_test_functions.jsonl/75555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2959
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
368,
341,
286,
1077,
1622,
16,
284,
330,
16,
13,
16,
3263,
6400,
27638,
11269,
10483,
15454,
543,
286,
1077,
1622,
17,
284,
330,
16,
13,
16,
16,
3263,
6400,
27638,
11269,
10483,
15454,
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_mixed_mixed_array_in_inline_table_fail() {
let _ = env_logger::init();
let parser = TOMLParser::new();
let (parser, result) = parser.parse(r#"[foo.quality.machine.parts.service]
"ƥèřïôδ" = 24.7
"inline table" = { drink = 5.5, meal = [ 6, { start = 1980-05-14, end = 2002-10-19 } ], dessert = '''cake''' }
[owner]
a_key = "a value"
"#);
assert!(check_errors(&parser, &result).0, "There should have been a mixed array error, but there wasn't.");
let errors = parser.get_errors();
let error = &errors.borrow()[0];
if let &ParseError::MixedArray(ref key, line, _col) = error {
assert!(key == "foo.quality.machine.parts.service.\"inline table\".meal" && line == 3,
"key should be \"foo.quality.machine.parts.service.\"inline table\".meal\", but is: \"{}\", line number should be 3, but is: {}",
key, line);
} else {
assert!(false, "The first error should have been a mixed array error, but it wasn't.");
}
} | rust_cleaned_test_functions.jsonl/122800 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
3286,
717,
3286,
3858,
1243,
41871,
5237,
22121,
368,
341,
220,
1077,
716,
284,
6105,
27413,
486,
2327,
1428,
220,
1077,
6729,
284,
82465,
43,
6570,
486,
931,
543,
220,
1077,
320,
9657,
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... | 3 |
#[test]
fn test_comments_in_rules() {
let text = r#"
rule a {}
rule b, c
// a line comment
{}
rule d
// another line comment
e {}
rule f/* a multine
comment*/{}
rule g/* another multine
comment*/h
i {}
rule j/*commeeeeent
you like things like "{}" in there? :)
*/
end {}"#;
let against = r#"
rule a {}
rule b, c {}
rule d e {}
rule f {}
rule gh i {}
rule j end {}
"#;
let mut ret = Vec::new();
get_differences(&load_css_paths(against.as_bytes()),
&load_css_paths(text.as_bytes()),
&mut ret);
assert!(ret.is_empty());
} | rust_cleaned_test_functions.jsonl/106110 | {
"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,
30359,
1243,
21407,
368,
341,
262,
1077,
1467,
284,
435,
2,
698,
12937,
264,
10086,
12937,
293,
11,
272,
198,
322,
264,
1555,
3980,
198,
31483,
12937,
294,
198,
322,
2441,
1555,
3980,
198,
68,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_interface() {
let interface = "90001";
assert_eq!("9.0.1", format_interface_into_game_version(interface));
let interface = "11305";
assert_eq!("1.13.5", format_interface_into_game_version(interface));
let interface = "100000";
assert_eq!("100000", format_interface_into_game_version(interface));
let interface = "9.0.1";
assert_eq!("9.0.1", format_interface_into_game_version(interface));
} | rust_cleaned_test_functions.jsonl/115661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20546,
368,
341,
286,
1077,
3749,
284,
330,
24,
15,
15,
15,
16,
876,
286,
2060,
10714,
17223,
24,
13,
15,
13,
16,
497,
3561,
20546,
45514,
18547,
9438,
75487,
3237,
286,
1077,
3749,
284,
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_str_truncate_invalid_len() {
let mut s = TinyString::<[u8; 16]>::from("12345");
s.truncate(6);
assert_eq!(s, "12345");
} | rust_cleaned_test_functions.jsonl/3634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
3547,
26900,
31433,
6043,
368,
341,
10217,
5206,
274,
284,
47974,
703,
27638,
58,
84,
23,
26,
220,
16,
21,
60,
6831,
1499,
445,
16,
17,
18,
19,
20,
797,
1903,
5427,
26900,
7,
21,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fsm_abandon_update() {
let update = Release {
version: "v1".to_string(),
checksum: "ostree-checksum".to_string(),
age_index: None,
};
let mut machine = UpdateAgentState::NoNewUpdate;
machine.update_available(update.clone());
assert_eq!(
machine,
UpdateAgentState::UpdateAvailable((update.clone(), 0))
);
// MAX-1 temporary failures.
for attempt in 1..MAX_DEPLOY_ATTEMPTS {
let (persistent_err, _) = machine.record_failed_deploy();
assert_eq!(persistent_err, false);
assert_eq!(
machine,
UpdateAgentState::UpdateAvailable((update.clone(), attempt as u8))
)
}
// Persistent error threshold reached.
let (persistent_err, _) = machine.record_failed_deploy();
assert_eq!(persistent_err, true);
assert_eq!(machine, UpdateAgentState::NoNewUpdate);
} | rust_cleaned_test_functions.jsonl/98156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 482
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
97069,
22885,
11037,
8882,
368,
341,
286,
1077,
2647,
284,
17381,
341,
310,
2319,
25,
330,
85,
16,
3263,
983,
3904,
3148,
310,
32529,
25,
330,
535,
765,
15934,
1242,
3263,
983,
3904,
3148,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_stoarge_raw_batch_put_ttl() {
test_stoarge_raw_batch_put_ttl_impl(ApiVersion::V1ttl);
test_stoarge_raw_batch_put_ttl_impl(ApiVersion::V2);
} | rust_cleaned_test_functions.jsonl/87573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
78,
2744,
16067,
14534,
15557,
87157,
368,
341,
262,
1273,
1261,
78,
2744,
16067,
14534,
15557,
87157,
21007,
65830,
5637,
486,
53,
16,
62858,
317,
262,
1273,
1261,
78,
2744,
16067,
14534,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unicast_addr() {
assert_eq!(
UnicastAddr::new(Address::GlobalUnicast),
Some(UnicastAddr(Address::GlobalUnicast))
);
assert_eq!(UnicastAddr::new(Address::GlobalMulticast), None);
assert_eq!(
unsafe { UnicastAddr::new_unchecked(Address::GlobalUnicast) },
UnicastAddr(Address::GlobalUnicast)
);
} | rust_cleaned_test_functions.jsonl/33644 | {
"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,
62,
3525,
559,
7387,
368,
341,
286,
2060,
10714,
33673,
310,
1230,
35446,
13986,
486,
931,
68492,
486,
11646,
1806,
35446,
1326,
310,
4329,
49289,
35446,
13986,
68492,
486,
11646,
1806,
35446,
1171,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_key_passed_to_program() {
let key0 = Pubkey::new_unique();
let key1 = Pubkey::new_unique();
let loader2 = Pubkey::new_unique();
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let message = Message::new_with_compiled_instructions(
1,
0,
2,
vec![key0, key1, loader2],
Hash::default(),
instructions,
);
assert!(message.is_key_passed_to_program(0));
assert!(message.is_key_passed_to_program(1));
assert!(!message.is_key_passed_to_program(2));
} | rust_cleaned_test_functions.jsonl/55535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
3097,
87405,
2346,
25096,
368,
341,
286,
1077,
1376,
15,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
1376,
16,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
16047,
17,
284,
22611... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_vote_threshold_below_threshold() {
let mut tower = Tower::new(EpochStakes::new_for_tests(2), 1, 0.67);
let stakes = vec![(
0,
StakeLockout {
stake: 1,
lockout: 8,
},
)]
.into_iter()
.collect();
tower.record_vote(0, Hash::default());
assert!(!tower.check_vote_stake_threshold(1, &stakes));
} | rust_cleaned_test_functions.jsonl/113944 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
54360,
21858,
82750,
21858,
368,
341,
286,
1077,
5206,
21271,
284,
21938,
486,
931,
10722,
79,
4953,
623,
2050,
486,
931,
5478,
32509,
7,
17,
701,
220,
16,
11,
220,
15,
13,
21,
22,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_e_divisive() {
let data_1 = [0., 0., 0., 0., 0., 0., 1., 1., 1., 1., 1., 5., 5., 5., 5., 5.];
let _cp = e_divisive(&data_1, 3, 0.05, 100);
let mut cp = _cp.clone();
cp.sort();
assert_eq!(cp, vec![5, 10]);
let data_1 = [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 5, 5, 5, 5, 5];
let _cp = e_divisive(&data_1, 3, 0.05, 100);
let mut cp = _cp.clone();
cp.sort();
assert_eq!(cp, vec![5, 10]);
} | rust_cleaned_test_functions.jsonl/57986 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
16237,
285,
533,
368,
341,
286,
1077,
821,
62,
16,
284,
508,
15,
2572,
220,
15,
2572,
220,
15,
2572,
220,
15,
2572,
220,
15,
2572,
220,
15,
2572,
220,
16,
2572,
220,
16,
2572,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_serial_stream() {
let buffer_output = [13, 0, 168, 19, 5, 29, 2, 25, 13, 0, 163, 19, 5, 29, 4];
let header_byte: u8 = 19;
let nbytes: u8 = 5;
let mut checksum = Checksum::new();
let mut byte_data = buffer_output.to_vec();
let succeeded = extract_sublist(&mut byte_data, [header_byte, nbytes], 8, &mut checksum);
println!("byte_data: {:?}", byte_data);
assert_eq!(byte_data, vec![19, 5, 29, 2, 25, 13, 0, 163]);
assert_eq!(true, succeeded);
checksum.push_slice(&buffer_output);
} | rust_cleaned_test_functions.jsonl/16130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
25602,
12673,
368,
341,
262,
1077,
4147,
7645,
284,
508,
16,
18,
11,
220,
15,
11,
220,
16,
21,
23,
11,
220,
16,
24,
11,
220,
20,
11,
220,
17,
24,
11,
220,
17,
11,
220,
17,
20,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_partitions() -> Result<()> {
let sc = CONTEXT.clone();
let rdd = sc.make_rdd(vec![1, 2, 3, 4], 2);
let partition_sums = rdd
.map_partitions(Fn!(
|iter: Box<dyn Iterator<Item = i64>>| Box::new(std::iter::once(iter.sum::<i64>()))
as Box<dyn Iterator<Item = i64>>
))
.collect()?;
assert_eq!(partition_sums, vec![3, 7]);
assert_eq!(rdd.glom().collect()?, vec![vec![1, 2], vec![3, 4]]);
Ok(())
} | rust_cleaned_test_functions.jsonl/27937 | {
"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,
5376,
99097,
368,
1464,
5714,
71698,
341,
262,
1077,
1136,
284,
87336,
15997,
543,
262,
1077,
435,
631,
284,
1136,
10117,
1710,
631,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
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... | 3 |
#[test]
fn test_format_docs_does_not_skip_lines_if_plain_text() {
let comment =
"```text\n # stay1\n# stay2\n#stay3\nstay4\n#\n #\n # \n #\tstay5\n\t#\t\n```";
assert_eq!(
format_docs(comment),
"```text\n # stay1\n# stay2\n#stay3\nstay4\n#\n #\n # \n #\tstay5\n\t#\t\n```",
);
} | rust_cleaned_test_functions.jsonl/57089 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
49692,
96374,
7913,
44830,
18323,
11119,
41015,
4326,
368,
341,
286,
1077,
3980,
4035,
310,
330,
73594,
1318,
1699,
671,
4717,
16,
1699,
2,
4717,
17,
1699,
2,
58921,
18,
1699,
58921,
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... | 1 |
#[test]
fn test_try_from_alogithm_id() {
assert_eq!(
AsymmetricAlgorithm::try_from(TPM2_ALG_RSA).unwrap(),
AsymmetricAlgorithm::Rsa
);
assert_eq!(
AsymmetricAlgorithm::try_from(TPM2_ALG_ECC).unwrap(),
AsymmetricAlgorithm::Ecc
);
assert!(
AsymmetricAlgorithm::try_from(TPM2_ALG_ERROR).is_err(),
"Error should not exist in AsymmetricAlgorithm"
);
} | rust_cleaned_test_functions.jsonl/41496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
8418,
538,
410,
76,
842,
368,
341,
286,
2060,
10714,
33673,
310,
1634,
29459,
27847,
486,
1539,
5673,
4140,
8795,
17,
8912,
38,
76994,
568,
15454,
3148,
310,
1634,
29459,
27847,
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_estimate_bias() {
let builder = PassThroughHasherBuilder {};
let hll: HyperLogLogPlus<u64, PassThroughHasherBuilder> =
HyperLogLogPlus::new(4, builder).unwrap();
let bias = hll.estimate_bias(14.0988);
assert!((bias - 7.5988).abs() <= 1e-5);
let bias = hll.estimate_bias(10.0);
assert!((bias - 10.0).abs() < 1e-5);
let bias = hll.estimate_bias(80.0);
assert!((bias - (-1.7606)).abs() < 1e-5);
let builder = PassThroughHasherBuilder {};
let hll: HyperLogLogPlus<u64, PassThroughHasherBuilder> =
HyperLogLogPlus::new(16, builder).unwrap();
let bias = hll.estimate_bias(55391.4373);
assert!((bias - 39416.9373).abs() < 1e-5);
let builder = PassThroughHasherBuilder {};
let hll: HyperLogLogPlus<u64, PassThroughHasherBuilder> =
HyperLogLogPlus::new(18, builder).unwrap();
let bias = hll.estimate_bias(275468.768);
assert!((bias - 118181.769).abs() <= 1e-3);
let bias = hll.estimate_bias(587532.522);
assert!((bias - 23922.523).abs() <= 1e-3);
let bias = hll.estimate_bias(1205430.993);
assert!((bias - (-434.006000000052)).abs() <= 1e-3);
let bias = hll.estimate_bias(1251260.649);
assert!((bias - (-479.351000000024)).abs() <= 1e-3);
} | rust_cleaned_test_functions.jsonl/8349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 664
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78718,
36381,
368,
341,
286,
1077,
7363,
284,
9970,
23857,
6370,
261,
3297,
20375,
286,
1077,
305,
654,
25,
32732,
2201,
2201,
21807,
34837,
21,
19,
11,
9970,
23857,
6370,
261,
3297,
29,
4035,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fd_table_install() {
let kern = Kernel::new_for_testing();
let files = FdTable::new();
let file = SyslogFile::new(&kern);
let fd0 = files.add(file.clone()).unwrap();
assert_eq!(fd0.raw(), 0);
let fd1 = files.add(file.clone()).unwrap();
assert_eq!(fd1.raw(), 1);
assert!(Arc::ptr_eq(&files.get(fd0).unwrap(), &file));
assert!(Arc::ptr_eq(&files.get(fd1).unwrap(), &file));
assert_eq!(files.get(FdNumber::from_raw(fd1.raw() + 1)).map(|_| ()), error!(EBADF));
} | rust_cleaned_test_functions.jsonl/18488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17676,
5237,
34245,
368,
341,
286,
1077,
82585,
284,
36603,
486,
931,
5478,
70962,
543,
286,
1077,
3542,
284,
434,
67,
2556,
486,
931,
543,
286,
1077,
1034,
284,
28909,
839,
1703,
486,
931,
2099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_options_de_from_cli_comma_separated_key_value() {
let mut exp_include_roots = BTreeMap::<String, String>::new();
exp_include_roots.insert("foo".into(), "bar".into());
exp_include_roots.insert("bar".into(), "baz".into());
const CLI_ARG: &str = "hhvm.include_roots=foo:bar,bar:baz";
let act = Options::from_configs_(&EMPTY_STRS, &[CLI_ARG]).unwrap();
assert_eq!(act.hhvm.include_roots.global_value, exp_include_roots,);
} | rust_cleaned_test_functions.jsonl/18288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8743,
2259,
5673,
47147,
2965,
1728,
3453,
49600,
3097,
3142,
368,
341,
286,
1077,
5206,
1343,
37878,
26608,
2412,
284,
425,
6533,
2227,
27638,
703,
11,
923,
6831,
931,
543,
286,
1343,
37878,
2660... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_slot_confirmed_not_enough_stake_failure() {
let locktower = Locktower::new(EpochStakes::new_for_tests(2), 1, 0.67);
let stakes = vec![(
0,
StakeLockout {
stake: 1,
lockout: 8,
},
)]
.into_iter()
.collect();
assert!(!locktower.is_slot_confirmed(0, &stakes));
} | rust_cleaned_test_functions.jsonl/25560 | {
"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,
6892,
27563,
16059,
8434,
7913,
6205,
1384,
1261,
726,
43618,
368,
341,
286,
1077,
5296,
77578,
284,
15701,
77578,
486,
931,
10722,
79,
4953,
623,
2050,
486,
931,
5478,
32509,
7,
17,
701,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pass_initiate() {
ExtBuilder::build().execute_with(|| {
let alice_pair = account_pair("Alice");
let bob_pair = account_pair("Bob");
let (players, _)
= get_sorted_peer(alice_pair, bob_pair);
let initiate_request = AppInitiateRequest {
nonce: 0,
players: players.clone(),
timeout: 2,
min_stone_offchain: 5,
max_stone_onchain: 5,
};
assert_ok!(SingleGomoku::app_initiate(
Origin::signed(players[0]),
initiate_request)
);
})
} | rust_cleaned_test_functions.jsonl/78903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
6137,
6493,
368,
341,
262,
9447,
3297,
486,
5834,
1005,
10257,
6615,
79453,
341,
286,
1077,
70433,
14445,
284,
2692,
14445,
445,
61686,
797,
286,
1077,
35192,
14445,
284,
2692,
14445,
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... | 2 |
#[test]
fn test_rpc_get_recent_performance_samples_invalid_limit() {
let rpc = RpcHandler::start();
let request = create_test_request("getRecentPerformanceSamples", Some(json!([10_000])));
let response = parse_failure_response(rpc.handle_request_sync(request));
let expected = (
ErrorCode::InvalidParams.code(),
String::from("Invalid limit; max 720"),
);
assert_eq!(response, expected);
} | rust_cleaned_test_functions.jsonl/6294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
62361,
84833,
18297,
31433,
14763,
368,
341,
286,
1077,
35596,
284,
79961,
3050,
486,
2468,
543,
286,
1077,
1681,
284,
1855,
4452,
7893,
445,
455,
25140,
34791,
39571,
497,
4329,
9304,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_fn() {
let context = Context::create();
let builder = context.create_builder();
let module = context.create_module("fns");
let void_type = context.void_type();
let fn_type = void_type.fn_type(&[], false);
let function = module.add_function("fn", fn_type, None);
#[cfg(not(any(feature = "llvm3-9", feature = "llvm4-0", feature = "llvm5-0", feature = "llvm6-0", feature = "llvm7-0", feature = "llvm8-0")))]
assert!(!function.verify(false));
#[cfg(any(feature = "llvm3-9", feature = "llvm4-0", feature = "llvm5-0", feature = "llvm6-0", feature = "llvm7-0", feature = "llvm8-0"))]
assert!(function.verify(false));
let basic_block = context.append_basic_block(&function, "entry");
builder.position_at_end(&basic_block);
builder.build_return(None);
assert!(function.verify(false));
// TODO: Verify other verify modes
} | rust_cleaned_test_functions.jsonl/122303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
15246,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
7363,
284,
2266,
2520,
28532,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
69,
4412,
3071,
262,
1077,
737,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write() {
let mut buf = Vec::new();
{
let opts = Lz77Options { window_size: 12 };
let mut encoder = Lz77Encoder::<_, LinearSearcher>::new(&mut buf, opts);
assert!(write!(encoder,
"aaabcabcaaaa abc abc abc aaacccdddbla b,asfdsafsafs fsadfsdfasf")
.is_ok());
assert!(encoder.flush().is_ok());
}
{
let opts = Lz77Options { window_size: 12 };
let mut cursor = Cursor::new(buf);
let mut decoder = Lz77Decoder::new(&mut cursor, opts);
let mut output = Vec::new();
assert!(copy(&mut decoder, &mut output).is_ok());
let string = String::from_utf8(output).expect("No valid utf8");
assert_eq!(string,
"aaabcabcaaaa abc abc abc aaacccdddbla b,asfdsafsafs fsadfsdfasf"
.to_owned());
println!("String::from_utf8(output) = {:#?}", string);
}
} | rust_cleaned_test_functions.jsonl/32603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 572
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
368,
341,
286,
1077,
5206,
6607,
284,
11312,
486,
931,
543,
286,
341,
310,
1077,
12185,
284,
444,
89,
22,
22,
3798,
314,
3241,
2368,
25,
220,
16,
17,
2605,
310,
1077,
5206,
23668,
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_min_max() {
assert!(min(0, 1) == 0);
assert!(min(-1.0, 0.0) == -1.0);
assert!(max(0, 1) == 1);
assert!(max(-1.0, 0.0) == 0.0);
} | rust_cleaned_test_functions.jsonl/67409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
6345,
368,
341,
262,
2060,
10297,
1065,
7,
15,
11,
220,
16,
8,
621,
220,
15,
317,
262,
2060,
10297,
1065,
4080,
16,
13,
15,
11,
220,
15,
13,
15,
8,
621,
481,
16,
13,
15,
626,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_associated_type_problem() {
// Regression test for a potential bindgen bug
let hdr = indoc! {"
namespace a {
template <typename> class b {};
} // namespace a
class bl {
a::b<bl> bm;
};
struct B {
int a;
};
"};
let rs = quote! {};
run_test("", hdr, rs, &["B"], &[]);
} | rust_cleaned_test_functions.jsonl/9821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58665,
657,
1819,
60139,
368,
341,
262,
442,
47470,
1273,
369,
264,
4650,
10719,
4370,
9876,
198,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
4473,
264,
341,
286,
3811,
366,
9031,
29,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_value_iterator_exact_size() {
let hash = b"hello".test_only_hash();
let mut iter = hash.iter_bits();
assert_eq!(iter.len(), HashValue::LENGTH_IN_BITS);
iter.next();
assert_eq!(iter.len(), HashValue::LENGTH_IN_BITS - 1);
iter.next_back();
assert_eq!(iter.len(), HashValue::LENGTH_IN_BITS - 2);
let iter_rev = hash.iter_bits().rev();
assert_eq!(iter_rev.len(), HashValue::LENGTH_IN_BITS);
let iter_skip = hash.iter_bits().skip(100);
assert_eq!(iter_skip.len(), HashValue::LENGTH_IN_BITS - 100);
} | rust_cleaned_test_functions.jsonl/118039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
3142,
13491,
71084,
2368,
368,
341,
262,
1077,
5175,
284,
293,
1,
14990,
3263,
1944,
18410,
8950,
1428,
262,
1077,
5206,
5367,
284,
5175,
19471,
20034,
543,
262,
2060,
10714,
10297,
2015,
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_hex_from_string() {
assert_eq!(Hex(0), "0".parse().unwrap());
assert_eq!(Hex(42), "42".parse().unwrap());
assert_eq!(Hex(42), "0x2a".parse().unwrap());
assert_eq!(Hex(42), "0X2A".parse().unwrap());
} | rust_cleaned_test_functions.jsonl/53235 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32655,
5673,
3904,
368,
341,
286,
2060,
10714,
10297,
20335,
7,
15,
701,
330,
15,
3263,
6400,
1005,
15454,
1423,
286,
2060,
10714,
10297,
20335,
7,
19,
17,
701,
330,
19,
17,
3263,
6400,
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_read_piece() {
let mut r = Reader::new();
r.state = State::Len;
let mut v = vec![0u8, 0, 0x40, 0x09, 7, 0, 0, 0, 1, 0, 0, 0, 1];
v.extend(vec![1u8; 16_384]);
v.extend(vec![0u8, 0, 0x40, 0x09, 7, 0, 0, 0, 1, 0, 0, 0, 1]);
v.extend(vec![1u8; 16_384]);
let mut p1 = Cursor::new(&v[0..10]);
let mut p2 = Cursor::new(&v[10..100]);
let mut p3 = Cursor::new(&v[100..]);
// Test partial read
assert_eq!(r.readable(&mut p1).unwrap(), None);
assert_eq!(r.readable(&mut p2).unwrap(), None);
match r.readable(&mut p3) {
RRes::Success(Message::Piece {
index,
begin,
length,
ref data,
}) => {
assert_eq!(index, 1);
assert_eq!(begin, 1);
assert_eq!(length, 16_384);
for i in 0..16_384 {
assert_eq!(1, data[i]);
}
}
res => {
panic!("Failed to get piece: {:?}", res);
}
}
} | rust_cleaned_test_functions.jsonl/46451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 693
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
48470,
368,
341,
286,
1077,
5206,
435,
284,
25166,
486,
931,
543,
286,
435,
3467,
284,
3234,
486,
11271,
280,
286,
1077,
5206,
348,
284,
7486,
20703,
15,
84,
23,
11,
220,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_update_fulfill_htlc_bolt2_update_fulfill_htlc_before_commitment() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let logger = test_utils::TestLogger::new();
let chan = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let (our_payment_preimage, our_payment_hash, our_payment_secret) = get_payment_preimage_hash!(nodes[1]);
let net_graph_msg_handler = &nodes[0].net_graph_msg_handler;
let route = get_route(&nodes[0].node.get_our_node_id(), &net_graph_msg_handler.network_graph, &nodes[1].node.get_our_node_id(), Some(InvoiceFeatures::known()), None, &[], 1000000, TEST_FINAL_CLTV, &logger).unwrap();
nodes[0].node.send_payment(&route, our_payment_hash, &Some(our_payment_secret)).unwrap();
check_added_monitors!(nodes[0], 1);
let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
let update_msg = msgs::UpdateFulfillHTLC{
channel_id: chan.2,
htlc_id: 0,
payment_preimage: our_payment_preimage,
};
nodes[0].node.handle_update_fulfill_htlc(&nodes[1].node.get_our_node_id(), &update_msg);
assert!(nodes[0].node.list_channels().is_empty());
let err_msg = check_closed_broadcast!(nodes[0], true).unwrap();
assert!(regex::Regex::new(r"Remote tried to fulfill/fail HTLC \(\d+\) before it had been committed").unwrap().is_match(err_msg.data.as_str()));
check_added_monitors!(nodes[0], 1);
check_closed_event!(nodes[0], 1, ClosureReason::ProcessingError { err: err_msg.data });
} | rust_cleaned_test_functions.jsonl/16931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
761,
86516,
49086,
17257,
880,
6181,
17,
8882,
761,
86516,
49086,
17257,
23708,
36346,
478,
368,
341,
15799,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_os_rng() {
let mut r = OsRng::new().unwrap();
r.next_u32();
r.next_u64();
let mut v = [0; 1000];
r.fill_bytes(&mut v);
} | rust_cleaned_test_functions.jsonl/87585 | {
"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,
29387,
66849,
368,
341,
286,
1077,
5206,
435,
284,
15433,
49,
968,
486,
931,
1005,
15454,
1428,
286,
435,
4529,
7300,
18,
17,
543,
286,
435,
4529,
7300,
21,
19,
1428,
286,
1077,
5206,
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 |
#[test]
fn test_lpad_utf8() {
let mut cases = vec![
(
Some("a多字节".as_bytes().to_vec()),
Some(3),
Some("测试".as_bytes().to_vec()),
Some("a多字".as_bytes().to_vec()),
),
(
Some("a多字节".as_bytes().to_vec()),
Some(4),
Some("测试".as_bytes().to_vec()),
Some("a多字节".as_bytes().to_vec()),
),
(
Some("a多字节".as_bytes().to_vec()),
Some(5),
Some("测试".as_bytes().to_vec()),
Some("测a多字节".as_bytes().to_vec()),
),
(
Some("a多字节".as_bytes().to_vec()),
Some(6),
Some("测试".as_bytes().to_vec()),
Some("测试a多字节".as_bytes().to_vec()),
),
(
Some("a多字节".as_bytes().to_vec()),
Some(7),
Some("测试".as_bytes().to_vec()),
Some("测试测a多字节".as_bytes().to_vec()),
),
(
Some("a多字节".as_bytes().to_vec()),
Some(i64::from(MAX_BLOB_WIDTH) / 4 + 1),
Some("测试".as_bytes().to_vec()),
None,
),
];
cases.append(&mut common_lpad_cases());
for (arg, len, pad, expect_output) in cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg)
.push_param(len)
.push_param(pad)
.evaluate(ScalarFuncSig::LpadUtf8)
.unwrap();
assert_eq!(output, expect_output);
}
} | rust_cleaned_test_functions.jsonl/10164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
13242,
39453,
23,
368,
341,
286,
1077,
5206,
5048,
284,
7486,
90515,
310,
2399,
394,
4329,
445,
64,
42140,
18600,
55502,
3263,
300,
12524,
1005,
983,
13251,
14702,
394,
4329,
7,
18,
1326,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_header_contents() {
let actual = builder()
.disable_header_comment()
.header_contents("test.h", "int foo(const char* a);")
.clang_arg("--target=x86_64-unknown-linux")
.generate()
.unwrap()
.to_string();
let (actual, stderr) = rustfmt(actual);
println!("{}", stderr);
let (expected, _) = rustfmt(
"extern \"C\" {
pub fn foo(a: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
}
"
.to_string(),
);
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/93769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
16682,
368,
341,
262,
1077,
5042,
284,
7363,
741,
286,
659,
18015,
8757,
17638,
741,
286,
659,
2708,
16682,
445,
1944,
860,
497,
330,
396,
15229,
2741,
1161,
9,
264,
1215,
1138,
286,
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_extend_ref() {
let mut a = BTreeSet::new();
a.insert(1);
a.extend(&[2, 3, 4]);
assert_eq!(a.len(), 4);
assert!(a.contains(&1));
assert!(a.contains(&2));
assert!(a.contains(&3));
assert!(a.contains(&4));
let mut b = BTreeSet::new();
b.insert(5);
b.insert(6);
a.extend(&b);
assert_eq!(a.len(), 6);
assert!(a.contains(&1));
assert!(a.contains(&2));
assert!(a.contains(&3));
assert!(a.contains(&4));
assert!(a.contains(&5));
assert!(a.contains(&6));
} | rust_cleaned_test_functions.jsonl/4417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70265,
7793,
368,
341,
262,
1077,
5206,
264,
284,
425,
6533,
1649,
486,
931,
543,
262,
264,
7030,
7,
16,
626,
262,
264,
15831,
2099,
58,
17,
11,
220,
18,
11,
220,
19,
10149,
262,
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_raftkv() {
let count = 1;
let mut cluster = new_server_cluster(0, count);
cluster.run();
// make sure leader has been elected.
assert_eq!(cluster.must_get(b"k1"), None);
let region = cluster.get_region(b"");
let leader_id = cluster.leader_of_region(region.get_id()).unwrap();
let storage = cluster.sim.rl().storages[&leader_id.get_id()].clone();
let mut ctx = Context::default();
ctx.set_region_id(region.get_id());
ctx.set_region_epoch(region.get_region_epoch().clone());
ctx.set_peer(region.get_peers()[0].clone());
get_put(&ctx, &storage);
batch(&ctx, &storage);
seek(&ctx, &storage);
near_seek(&ctx, &storage);
cf(&ctx, &storage);
empty_write(&ctx, &storage);
wrong_context(&ctx, &storage);
// TODO: test multiple node
} | rust_cleaned_test_functions.jsonl/15821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2944,
43408,
368,
341,
262,
1077,
1760,
284,
220,
16,
280,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
15,
11,
1760,
317,
262,
10652,
7634,
1428,
262,
442,
1281,
2704,
7653,
702,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_metadata_e2e() {
let mut auth = MetadataAccess::new().build();
let tok = auth.token(vec!["https://www.googleapis.com/auth/drive.file".to_string()]);
let fut = tok.map_err(|e| println!("error: {:?}", e)).and_then(|t| {
println!("The token is {:?}", t);
Ok(())
});
tokio::run(fut);
} | rust_cleaned_test_functions.jsonl/46631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22220,
2204,
17,
68,
368,
341,
286,
1077,
5206,
4166,
284,
33589,
6054,
486,
931,
1005,
5834,
543,
286,
1077,
9628,
284,
4166,
14416,
25592,
0,
1183,
2428,
1110,
2136,
19758,
905,
17369,
48054,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_sub() {
match decode_16(0xb082) {
Instruction::SUB_imm { params, thumb32 } => {
assert!(params.rd == Reg::SP);
assert!(params.rn == Reg::SP);
assert!(params.imm32 == 0x8);
assert!(params.setflags == SetFlags::False);
assert!(thumb32 == false);
}
_ => {
assert!(false);
}
}
} | rust_cleaned_test_functions.jsonl/64749 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
5228,
368,
341,
1066,
262,
2432,
16895,
62,
16,
21,
7,
15,
7929,
15,
23,
17,
8,
341,
286,
29051,
486,
29038,
71370,
314,
3628,
11,
24050,
18,
17,
335,
589,
341,
310,
2060,
10297,
3519... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_debug() -> TestResult {
let p = polar();
p.load_str(indoc!(
r#"a() if debug("a") and b() and c() and d();
b();
c() if debug("c");
d();"#
))?;
let mut call_num = 0;
let debug_handler = |s: &str| {
let rt = match call_num {
0 => {
let expected = indoc!(
r#"
QUERY: debug(), BINDINGS: {}
001: a() if debug("a") and b() and c() and d();
^
002: b();
003: c() if debug("c");
004: d();
"#
);
assert_eq!(s, expected);
"over"
}
1 => {
let expected = indoc!(
r#"
QUERY: b(), BINDINGS: {}
001: a() if debug("a") and b() and c() and d();
^
002: b();
003: c() if debug("c");
004: d();
"#
);
assert_eq!(s, expected);
"over"
}
2 => {
let expected = indoc!(
r#"
QUERY: c(), BINDINGS: {}
001: a() if debug("a") and b() and c() and d();
^
002: b();
003: c() if debug("c");
004: d();
"#
);
assert_eq!(s, expected);
"over"
}
3 => {
let expected = indoc!(
r#"
QUERY: debug(), BINDINGS: {}
001: a() if debug("a") and b() and c() and d();
002: b();
003: c() if debug("c");
^
004: d();
"#
);
assert_eq!(s, expected);
"over"
}
4 => {
let expected = indoc!(
r#"
QUERY: d(), BINDINGS: {}
001: a() if debug("a") and b() and c() and d();
^
002: b();
003: c() if debug("c");
004: d();
"#
);
assert_eq!(s, expected);
"over"
}
_ => panic!("Too many calls!"),
};
call_num += 1;
rt.to_string()
};
let q = p.new_query("a()", false)?;
let _results = query_results!(q, no_results, no_externals, debug_handler);
let p = polar();
p.load_str(indoc!(
r#"a() if debug() and b() and c() and d();
a() if 5 = 5;
b() if 1 = 1 and 2 = 2;
c() if 3 = 3 and 4 = 4;
d();"#
))?;
let mut call_num = 0;
let debug_handler = |s: &str| {
let rt = match call_num {
0 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: debug(), BINDINGS: {}");
"step"
}
1 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: b(), BINDINGS: {}");
"step"
}
2 => {
assert_eq!(
s.lines().next().unwrap(),
"QUERY: 1 = 1 and 2 = 2, BINDINGS: {}"
);
"out"
}
3 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: c(), BINDINGS: {}");
"step"
}
4 => {
assert_eq!(
s.lines().next().unwrap(),
"QUERY: 3 = 3 and 4 = 4, BINDINGS: {}"
);
"stack"
}
5 => {
let expected = indoc! {"
trace (most recent evaluation last):
003: a()
in query at line 1, column 1
002: debug() and b() and c() and d()
in rule a at line 1, column 8
001: c()
in rule a at line 1, column 28
000: 3 = 3 and 4 = 4
in rule c at line 4, column 8
"};
assert_eq!(s, expected);
"step"
}
6 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: 3 = 3, BINDINGS: {}");
"out"
}
7 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: d(), BINDINGS: {}");
"over"
}
8 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: 5 = 5, BINDINGS: {}");
"c"
}
_ => panic!("Too many calls: {}", s),
};
call_num += 1;
rt.to_string()
};
let q = p.new_query("a()", false)?;
let _results = query_results!(q, no_results, no_externals, debug_handler);
Ok(())
} | rust_cleaned_test_functions.jsonl/68126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3576
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
543,
262,
281,
5104,
2895,
23884,
509,
33673,
286,
435,
55543,
64,
368,
421,
7390,
445,
64,
899,
323,
293,
368,
323,
272,
368,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_interior_nul_in_env_key_is_error() {
match env_cmd().env("has-some-\0\0s-inside", "value").spawn() {
Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput),
Ok(_) => panic!(),
}
} | rust_cleaned_test_functions.jsonl/5493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15318,
2462,
1089,
360,
1243,
15879,
3097,
6892,
4096,
368,
341,
286,
2432,
6105,
11684,
1005,
3160,
445,
4648,
1331,
635,
30529,
15,
59,
15,
82,
21853,
577,
497,
330,
957,
1827,
46087,
368,
341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_tx_out_search_result_enum_values() {
assert_eq!(
mc_fog_types::view::TxOutSearchResultCode::Found as u32,
mc_fog_api::view::TxOutSearchResultCode::Found as u32
);
assert_eq!(
mc_fog_types::view::TxOutSearchResultCode::NotFound as u32,
mc_fog_api::view::TxOutSearchResultCode::NotFound as u32
);
assert_eq!(
mc_fog_types::view::TxOutSearchResultCode::BadSearchKey as u32,
mc_fog_api::view::TxOutSearchResultCode::BadSearchKey as u32
);
assert_eq!(
mc_fog_types::view::TxOutSearchResultCode::InternalError as u32,
mc_fog_api::view::TxOutSearchResultCode::InternalError as u32
);
assert_eq!(
mc_fog_types::view::TxOutSearchResultCode::RateLimited as u32,
mc_fog_api::view::TxOutSearchResultCode::RateLimited as u32
);
} | rust_cleaned_test_functions.jsonl/96781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17805,
6068,
10716,
5287,
31054,
9146,
368,
341,
262,
2060,
10714,
33673,
286,
19223,
761,
538,
9763,
486,
1050,
486,
31584,
2662,
5890,
2077,
2078,
486,
6650,
438,
575,
18,
17,
345,
286,
19223,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_channel_config() {
let mut data = vec![
0xa4, 0x9e, 0x79, 0x5a, // magic
1, 0, // version
55, 0, // data_len
0xcc, 0xa3, 0xdd, 0xeb, // data_checksum
0x4e, 0xf3, 0x5a, 0x57, // header_checksum
];
let json = br#"{"channel_name":"some-channel","tuf_config_name":"tuf"}"#;
data.extend_from_slice(json);
data.resize(4096, 0);
sys_mock::set_data(data);
let config = OtaUpdateChannelConfig {
channel_name: "some-channel".to_string(),
tuf_config_name: "tuf".to_string(),
};
assert_eq!(read_channel_config().unwrap(), config);
} | rust_cleaned_test_functions.jsonl/43604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
14571,
5332,
368,
341,
286,
1077,
5206,
821,
284,
7486,
90515,
310,
220,
15,
9591,
19,
11,
220,
15,
87,
24,
68,
11,
220,
15,
87,
22,
24,
11,
220,
15,
87,
20,
64,
11,
442,
10963,
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_runtime_resume() {
let req = VmmAction::Resume;
check_runtime_request(req, |result, vmm| {
assert_eq!(result, Ok(VmmData::Empty));
assert!(vmm.resume_called)
});
let req = VmmAction::Resume;
check_runtime_request_err(req, VmmActionError::InternalVmm(VmmError::VcpuResume));
} | rust_cleaned_test_functions.jsonl/44540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33232,
58132,
368,
341,
286,
1077,
4232,
284,
647,
3821,
2512,
486,
28563,
280,
286,
1779,
33232,
7893,
6881,
11,
760,
1382,
11,
348,
3821,
91,
341,
310,
2060,
10714,
10297,
1382,
11,
7622,
1241... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ends_with() {
test(true, b"");
test(true, b"r");
test(true, b"ar");
test(true, b"bar");
if cfg!(not(windows)) {
test(true, b"\xA9bar");
test(true, b"\x92\xA9bar");
test(true, b"\x9F\x92\xA9bar");
}
test(cfg!(windows), b"\xED\xB2\xA9bar");
test(true, b"\xF0\x9F\x92\xA9bar");
test(true, b"\xED\xA0\xBD\xF0\x9F\x92\xA9bar");
test(true, b"o\xED\xA0\xBD\xF0\x9F\x92\xA9bar");
test(true, b"oo\xED\xA0\xBD\xF0\x9F\x92\xA9bar");
test(true, b"foo\xED\xA0\xBD\xF0\x9F\x92\xA9bar");
test(false, b"\xED\xA0\xBDbar");
test(false, b"\xED\xB2\xA9aar");
fn test(result: bool, suffix: &[u8]) {
let suffix = from_bytes(suffix).unwrap();
assert_eq!(result, RAW_WTF8_STRING.ends_with_os(suffix));
}
} | rust_cleaned_test_functions.jsonl/55744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 485
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90729,
6615,
368,
341,
262,
1273,
3715,
11,
293,
1,
797,
262,
1273,
3715,
11,
293,
1,
81,
797,
262,
1273,
3715,
11,
293,
1,
277,
797,
262,
1273,
3715,
11,
293,
1,
2257,
797,
262,
421,
1328... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_three_letters() {
assert_alphametic_solution_eq("I + BB == ILL", &[('I', 1), ('B', 9), ('L', 0)]);
} | rust_cleaned_test_functions.jsonl/60609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 63
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
50016,
67330,
368,
341,
262,
2060,
8418,
759,
309,
5298,
50274,
10714,
445,
40,
488,
18270,
621,
358,
4086,
497,
44590,
492,
40,
516,
220,
16,
701,
4319,
33,
516,
220,
24,
701,
4319,
43,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_skew_nil() {
let root: AANode<char> = tree!();
println!("Input: {:?}", root);
let skewed = root.skew();
let expected = tree!();
assert_eq!(skewed, expected);
} | rust_cleaned_test_functions.jsonl/9203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33811,
365,
36175,
368,
341,
197,
10217,
3704,
25,
362,
1093,
534,
21919,
29,
284,
4916,
0,
543,
197,
81168,
17223,
2505,
25,
71964,
3704,
317,
197,
10217,
86472,
284,
3704,
39454,
365,
543,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_codegen_options_tracking_hash() {
let reference = Options::default();
let mut opts = Options::default();
// Make sure the changing an [UNTRACKED] option leaves the hash unchanged
opts.cg.ar = Some(String::from("abc"));
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.cg.linker = Some(PathBuf::from("linker"));
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.cg.link_args = Some(vec![String::from("abc"), String::from("def")]);
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.cg.link_dead_code = true;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.cg.rpath = true;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.cg.extra_filename = String::from("extra-filename");
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.cg.codegen_units = Some(42);
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.cg.remark = super::Passes::Some(vec![String::from("pass1"), String::from("pass2")]);
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.cg.save_temps = true;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.cg.incremental = Some(String::from("abc"));
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
// Make sure changing a [TRACKED] option changes the hash
opts = reference.clone();
opts.cg.lto = LtoCli::Fat;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.target_cpu = Some(String::from("abc"));
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.target_feature = String::from("all the features, all of them");
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.passes = vec![String::from("1"), String::from("2")];
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.llvm_args = vec![String::from("1"), String::from("2")];
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.overflow_checks = Some(true);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.no_prepopulate_passes = true;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.no_vectorize_loops = true;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.no_vectorize_slp = true;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.soft_float = true;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.prefer_dynamic = true;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.no_integrated_as = true;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.no_redzone = Some(true);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.relocation_model = Some(String::from("relocation model"));
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.code_model = Some(String::from("code model"));
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.debugging_opts.tls_model = Some(String::from("tls model"));
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.debugging_opts.pgo_gen = Some(String::from("abc"));
assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts = reference.clone();
opts.debugging_opts.pgo_use = String::from("abc");
assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.metadata = vec![String::from("A"), String::from("B")];
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.debuginfo = Some(0xdeadbeef);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.debuginfo = Some(0xba5eba11);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.force_frame_pointers = Some(false);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.debug_assertions = Some(true);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.inline_threshold = Some(0xf007ba11);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.cg.panic = Some(PanicStrategy::Abort);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
} | rust_cleaned_test_functions.jsonl/44826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32018,
8743,
66105,
8950,
368,
341,
286,
1077,
5785,
284,
14566,
486,
2258,
543,
286,
1077,
5206,
12185,
284,
14566,
486,
2258,
1428,
286,
442,
7405,
2704,
279,
10018,
458,
508,
1861,
88872,
1479,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_balanced_string() {
let test_cases = vec![
("EQWEEEWERRWERQQQWWQEQWEEWQRWQWWWQWRWEWERWQEWWQWWQRRQWQERWWQRERRRRRWQEQRERRWRREEEERRWERQRQEWREQREWWEWRRRERWRRWEQWQQRRWQEREEEERWQWEWQEWRWREWQEREQWQEQWRQQQWRWWRWERWQWWQQREWREEWRWWQRWQRWWQWWREWWWEWQRWRRWQEWRRRWWQRRQREQRWRRQWREQWEQRWQRWQRWERRREEREEQQEREREWQQWRWEWEQQRWEWEQWEEQEEERWWWEQRRRWRQWWQQEQRWRWRWEQRRQRQRQWWWEQWERWEQRWQRERWQQQWWWQWRWEREWRQWQWERRQQWRQWRWQQQEEQREQWRWWEQRWWWEEERQWQWEWRQQRWQWEQQEWEWRQWWERERQREWWEEREQRRWQRRRWQEEWEWQEEEQRQQEWREQWQWRRWREQQQEEEWWRQEEEWQQEQEQWWREEWRQQQRQQEERQQQEEQWERRQEEQQRQQQWWEQEEQWRQWEQWEEQQEEQQEERQEEWQEEEWQRERRERQRQQQQWRQRRQQWQEEWRRQEWQWREWERWQRQQWEEERREQEEQWQQRWERWRWEEQWEREREWRWREEWRRRQEQQERRRERQRQWRWWREQQWWEQQWQWRRWEQRWEQQEQWWWQWWEWWEEEWEWRQWQWWQQQQEWRQEQWWRWWEQRRRWREREWRQQERQRQEQWWQQWRQRRQRWRQEEEWRRQREWRRERRQEEREERWEQQQWEWWEERWQWQQWWEQWWQWERRRWQWEEEEQEEWQRRWRWEEEWEWRREWWEQQERRQWQEWQQQRWEWRQEQWREWEWEEWWWWWWWWEQRWRRQQEEEERQEWQQEQQEEEWWRWRQQQQWRREEWRWWWQRWRWRWQWWEREQQEEEWREERQEWEERQWQREEQRQWEQEREQWWEWEEWREREWRQQWREEEEQRRWRWRQRRRWRQQQRRQQRQEWEEQQEREWQEEWEWWEQRRQWRQRQQREREQRWWQEEERREWRREWRRRQQQRQEQEWQWEEQQERQRRRWRRWWEEQRWQQQQQQWREWEWWRQREWREQRRQEQEERRQERWEEQRWWQRWQRWWERQEWEQERWRWQRQEEQEQEWWQWWRREEWEWWRRQEQQWEERWEWWWQEWWRRWRWQEERQRQWEQQEWWRRRRWQEWQQQQWWEEE", 16),
("RRRERWERREEEQEWWEEQERREWRWREWQQEQRRWRERRRWWREEEERRRQREWWQWEQERREERRQWEQQEQERWEEQWREEEQQEWRWRQRERWERR", 22),
("QWQQEQWQ", 4),
("QWQWEQQQ", 3),
("QWER", 0),
("QQWE", 1),
("QQQE", 2),
("QQQQ", 3),
];
for (s, expect) in test_cases {
assert_eq!(Solution::balanced_string(s.to_string()), expect, "s: {}", s);
}
} | rust_cleaned_test_functions.jsonl/42982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56441,
4874,
3904,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
3489,
54007,
54,
32837,
54,
2650,
39351,
48026,
48,
18985,
48,
54007,
54,
7099,
54,
30465,
54,
48,
45508,
48,
17925,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_drop() {
let has_dropped = Flag::new();
let error = Error::new(DetectDrop::new(&has_dropped));
drop(error.downcast::<DetectDrop>().unwrap());
assert!(has_dropped.get());
} | rust_cleaned_test_functions.jsonl/69158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
368,
341,
262,
1077,
702,
814,
41716,
284,
22666,
486,
931,
543,
262,
1077,
1465,
284,
4600,
486,
931,
5432,
13176,
19871,
486,
931,
2099,
4648,
814,
41716,
1106,
262,
5943,
6390,
18148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_split_off() {
let mut tester = VecDeque::with_capacity(15);
// this test isn't covering what it wants to
let cap = tester.capacity();
// len is the length *before* splitting
for len in 0..cap {
// index to split at
for at in 0..len + 1 {
let expected_self = (0..).take(at).collect();
let expected_other = (at..).take(len - at).collect();
for tail_pos in 0..cap {
tester.tail = tail_pos;
tester.head = tail_pos;
for i in 0..len {
tester.push_back(i);
}
let result = tester.split_off(at);
assert!(tester.tail < tester.cap);
assert!(tester.head < tester.cap);
assert!(result.tail < result.cap);
assert!(result.head < result.cap);
assert_eq!(tester, expected_self);
assert_eq!(result, expected_other);
}
}
}
} | rust_cleaned_test_functions.jsonl/188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 711
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
13651,
368,
341,
1789,
23459,
286,
1077,
5206,
37111,
284,
11312,
73891,
486,
4197,
35603,
7,
16,
20,
317,
16885,
286,
442,
419,
1273,
4436,
944,
18202,
1128,
432,
6801,
311,
198,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_new_cmac_with_invalid_input() {
// key too short
assert!(
tink_mac::subtle::AesCmac::new(&get_random_bytes(1), 16).is_err(),
"expect an error when key is too short"
);
// tag too short
assert!(
tink_mac::subtle::AesCmac::new(&get_random_bytes(16), 9).is_err(),
"expect an error when tag size is too small"
);
// tag too big
assert!(
tink_mac::subtle::AesCmac::new(&get_random_bytes(16), 17).is_err(),
"expect an error when tag size is too big"
);
} | rust_cleaned_test_functions.jsonl/77131 | {
"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,
5921,
666,
11948,
6615,
31433,
5898,
368,
341,
262,
442,
1376,
2238,
2805,
198,
262,
2060,
33673,
286,
90584,
22802,
486,
1966,
11239,
486,
32,
288,
34,
11948,
486,
931,
2099,
455,
22644,
12524,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_output_item() {
let res_in = output_item(to_input(b"1 -> OUT:3"));
assert_full_result(
res_in,
OutputMapping {
from: 1.into(),
to: Port::new(Node::Out, 3.into()),
},
);
let res_node = output_item(to_input(b"1 -> #node:32"));
assert_full_result(
res_node,
OutputMapping {
from: 1.into(),
to: Port::named_port(&"node", 32.into()),
},
);
} | rust_cleaned_test_functions.jsonl/41390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
7645,
5634,
368,
341,
286,
1077,
592,
1243,
284,
2550,
5634,
12186,
5898,
1883,
1,
16,
1464,
9808,
25,
18,
4010,
286,
2060,
16372,
5287,
1006,
310,
592,
1243,
345,
310,
9258,
6807,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_join_lines_selection_dot_chain() {
check_join_lines_sel(
r"
fn foo() {
join(<|>type_params.type_params()
.filter_map(|it| it.name())
.map(|it| it.text())<|>)
}",
r"
fn foo() {
join(type_params.type_params().filter_map(|it| it.name()).map(|it| it.text()))
}",
);
} | rust_cleaned_test_functions.jsonl/79949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
18323,
23672,
30941,
30583,
368,
341,
286,
1779,
31017,
18323,
34153,
1006,
310,
435,
698,
8822,
15229,
368,
341,
262,
5138,
22726,
91,
29,
1313,
6745,
4852,
6745,
741,
310,
659,
5315,
5376... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_consume() {
let iterable = "123".chars();
let mut iter = iterable.peekmore();
assert_eq!(iter.peek(), Some(&core::char::from_digit(1, 10).unwrap()));
assert_eq!(
iter.peek_next(),
Some(&core::char::from_digit(2, 10).unwrap())
);
assert_eq!(
iter.peek_next(),
Some(&core::char::from_digit(3, 10).unwrap())
);
assert_eq!(iter.peek_next(), None);
assert_eq!(iter.next(), Some(core::char::from_digit(1, 10).unwrap()));
assert_eq!(iter.peek(), None);
assert_eq!(iter.peek_next(), None);
assert_eq!(iter.next(), Some(core::char::from_digit(2, 10).unwrap()));
assert_eq!(iter.peek(), None);
assert_eq!(iter.peek_next(), None);
assert_eq!(iter.next(), Some(core::char::from_digit(3, 10).unwrap()));
assert_eq!(iter.next(), None);
assert_eq!(iter.peek_next(), None);
} | rust_cleaned_test_functions.jsonl/72615 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
3382,
31323,
368,
341,
286,
1077,
50834,
284,
330,
16,
17,
18,
3263,
19255,
1428,
286,
1077,
5206,
5367,
284,
50834,
41249,
6384,
543,
286,
2060,
10714,
10297,
2015,
41249,
1507,
4329,
2099,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gga_gps() {
use chrono::Timelike;
let mut nmea = Nmea::new();
nmea.parse("$GPGGA,092750.000,5321.6802,S,00630.3372,E,1,8,1.03,61.7,M,55.2,M,,*79")
.unwrap();
assert_eq!(nmea.fix_timestamp().unwrap().second(), 50);
assert_eq!(nmea.fix_timestamp().unwrap().minute(), 27);
assert_eq!(nmea.fix_timestamp().unwrap().hour(), 9);
assert_eq!(-(53. + 21.6802 / 60.), nmea.latitude.unwrap());
assert_eq!(6. + 30.3372 / 60., nmea.longitude.unwrap());
assert_eq!(nmea.fix_type(), Some(FixType::Gps));
assert_eq!(8, nmea.num_of_fix_satellites.unwrap());
assert_eq!(1.03, nmea.hdop.unwrap());
assert_eq!(61.7, nmea.altitude.unwrap());
assert_eq!(55.2, nmea.geoid_height.unwrap());
} | rust_cleaned_test_functions.jsonl/65856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
6743,
83407,
368,
341,
286,
990,
80372,
486,
20217,
301,
2970,
280,
286,
1077,
5206,
308,
2660,
64,
284,
451,
2660,
64,
486,
931,
543,
286,
308,
2660,
64,
4632,
20912,
38,
11383,
16128,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_histogram_duration_with_overflow() {
let client = StatsdClient::from_sink("prefix", NopMetricSink);
let res = client.histogram_duration("key", Duration::from_secs(u64::MAX));
assert_eq!(ErrorKind::InvalidInput, res.unwrap_err().kind());
} | rust_cleaned_test_functions.jsonl/48382 | {
"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,
15381,
67,
8179,
68564,
25454,
6615,
79073,
368,
341,
286,
1077,
2943,
284,
29927,
67,
2959,
486,
1499,
51567,
445,
11849,
497,
451,
453,
54310,
45094,
317,
286,
1077,
592,
284,
2943,
94184,
25454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_string_lossy() {
Python::with_gil(|py| {
let obj: PyObject = py
.eval(r#"'🐈 Hello \ud800World'"#, None, None)
.unwrap()
.into();
let py_string = <PyString as PyTryFrom>::try_from(obj.as_ref(py)).unwrap();
assert_eq!(py_string.to_string_lossy(), "🐈 Hello ���World");
})
} | rust_cleaned_test_functions.jsonl/118019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
3904,
11193,
88,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
2839,
25,
15891,
284,
4510,
198,
394,
659,
14170,
2601,
2,
20584,
146833,
21927,
1124,
661,
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_decode_u32() {
let cases: &[(&[u8], u32, u32)] = &[
(&[0], 0, 0),
(&[10], 10, 10),
(&[U16_BYTE, 0, 10], 2560, 10),
(&[U32_BYTE, 0, 0, 0, 10], 167_772_160, 10),
];
for &(slice, expected_le, expected_be) in cases {
let mut reader = crate::de::read::SliceReader::new(slice);
let found = varint_decode_u32(&mut reader, Endian::Little).unwrap();
assert_eq!(expected_le, found);
let mut reader = crate::de::read::SliceReader::new(slice);
let found = varint_decode_u32(&mut reader, Endian::Big).unwrap();
assert_eq!(expected_be, found);
}
let errors: &[(&[u8], DecodeError)] = &[
(
&[U64_BYTE],
DecodeError::InvalidIntegerType {
expected: IntegerType::U32,
found: IntegerType::U64,
},
),
(
&[U128_BYTE],
DecodeError::InvalidIntegerType {
expected: IntegerType::U32,
found: IntegerType::U128,
},
),
(&[U16_BYTE], DecodeError::UnexpectedEnd { additional: 2 }),
(&[U16_BYTE, 0], DecodeError::UnexpectedEnd { additional: 1 }),
(&[U32_BYTE], DecodeError::UnexpectedEnd { additional: 4 }),
(&[U32_BYTE, 0], DecodeError::UnexpectedEnd { additional: 3 }),
(
&[U32_BYTE, 0, 0],
DecodeError::UnexpectedEnd { additional: 2 },
),
(
&[U32_BYTE, 0, 0, 0],
DecodeError::UnexpectedEnd { additional: 1 },
),
];
for (slice, expected) in errors {
let mut reader = crate::de::read::SliceReader::new(slice);
let found = varint_decode_u32(&mut reader, Endian::Little).unwrap_err();
assert_eq!(std::format!("{:?}", expected), std::format!("{:?}", found));
}
} | rust_cleaned_test_functions.jsonl/83341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 949
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
7300,
18,
17,
368,
341,
262,
1077,
5048,
25,
44590,
2099,
58,
84,
23,
1125,
575,
18,
17,
11,
575,
18,
17,
7252,
284,
609,
9640,
286,
15899,
58,
15,
1125,
220,
15,
11,
220,
15,
1326,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_fq_repr_num_bits() {
let mut a = FqRepr::from(0);
assert_eq!(0, a.num_bits());
a = FqRepr::from(1);
for i in 1..385 {
assert_eq!(i, a.num_bits());
a.mul2();
}
assert_eq!(0, a.num_bits());
} | rust_cleaned_test_functions.jsonl/2320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
68535,
4273,
20034,
368,
341,
286,
1077,
5206,
264,
284,
434,
80,
693,
649,
486,
1499,
7,
15,
317,
286,
2060,
10714,
10297,
15,
11,
264,
10522,
20034,
1423,
286,
264,
284,
434,
80,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hash_key_preprocessed_content_differs() {
let args = ovec!["a", "b", "c"];
assert_neq!(hash_key("abcd", Language::C, &args, &[], &b"hello world"[..]),
hash_key("abcd", Language::C, &args, &[], &b"goodbye"[..]));
} | rust_cleaned_test_functions.jsonl/22436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
3097,
10442,
34022,
7495,
15850,
388,
368,
341,
286,
1077,
2827,
284,
297,
4083,
0,
1183,
64,
497,
330,
65,
497,
330,
66,
6332,
286,
2060,
13925,
80,
10297,
8296,
3097,
445,
68644,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_lock() {
let path = tempfile::Builder::new()
.prefix("_test_storage_mvcc_reader_check_lock")
.tempdir()
.unwrap();
let path = path.path().to_str().unwrap();
let region = make_region(1, vec![], vec![]);
let db = open_db(path, true);
let mut engine = RegionEngine::new(&db, ®ion);
let (k1, k2, k3, k4, v) = (b"k1", b"k2", b"k3", b"k4", b"v");
engine.prewrite(Mutation::Put((Key::from_raw(k1), v.to_vec())), k1, 5);
engine.prewrite(Mutation::Put((Key::from_raw(k2), v.to_vec())), k1, 5);
engine.prewrite(Mutation::Lock(Key::from_raw(k3)), k1, 5);
let snap = RegionSnapshot::<RocksEngine>::from_raw(Arc::clone(&db), region.clone());
let mut reader = MvccReader::new(snap, None, false, IsolationLevel::Si);
// Ignore the lock if read ts is less than the lock version
assert!(reader.check_lock(&Key::from_raw(k1), 4.into()).is_ok());
assert!(reader.check_lock(&Key::from_raw(k2), 4.into()).is_ok());
// Returns the lock if read ts >= lock version
assert!(reader.check_lock(&Key::from_raw(k1), 6.into()).is_err());
assert!(reader.check_lock(&Key::from_raw(k2), 6.into()).is_err());
// Read locks don't block any read operation
assert!(reader.check_lock(&Key::from_raw(k3), 6.into()).is_ok());
assert!(reader
.check_lock(&Key::from_raw(k1), TimeStamp::max())
.is_ok());
// Should not ignore the secondary lock even though reading the latest version
assert!(reader
.check_lock(&Key::from_raw(k2), TimeStamp::max())
.is_err());
// Commit the primary lock only
engine.commit(k1, 5, 7);
let snap = RegionSnapshot::<RocksEngine>::from_raw(Arc::clone(&db), region.clone());
let mut reader = MvccReader::new(snap, None, false, IsolationLevel::Si);
// Then reading the primary key should succeed
assert!(reader.check_lock(&Key::from_raw(k1), 6.into()).is_ok());
// Reading secondary keys should still fail
assert!(reader.check_lock(&Key::from_raw(k2), 6.into()).is_err());
assert!(reader
.check_lock(&Key::from_raw(k2), TimeStamp::max())
.is_err());
// Pessimistic locks
engine.acquire_pessimistic_lock(Key::from_raw(k4), k4, 9, 9);
let snap = RegionSnapshot::<RocksEngine>::from_raw(Arc::clone(&db), region.clone());
let mut reader = MvccReader::new(snap, None, false, IsolationLevel::Si);
// Pessimistic locks don't block any read operation
assert!(reader.check_lock(&Key::from_raw(k4), 10.into()).is_ok());
} | rust_cleaned_test_functions.jsonl/78990 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
9818,
368,
341,
286,
1077,
1815,
284,
54819,
486,
3297,
486,
931,
741,
310,
659,
11849,
16975,
1944,
23310,
73187,
638,
22306,
7200,
9818,
1138,
310,
659,
3888,
3741,
741,
310,
659,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_tokens() -> anyhow::Result<()> {
// Given
let mut vocab_file = tempfile::NamedTempFile::new()?;
write!(
vocab_file,
"{{\"hello\": 1,\n \"world\": 0,\n \"<|endoftext|>\": 2,\n \"!\": 3\n}}"
)?;
let path = vocab_file.into_temp_path();
let gpt2_vocab = Gpt2Vocab::from_file(path.to_path_buf().to_str().unwrap())?;
assert_eq!(gpt2_vocab.id_to_token(&(1_i64)), "hello");
assert_eq!(gpt2_vocab.id_to_token(&(0_i64)), "world");
assert_eq!(gpt2_vocab.id_to_token(&(3_i64)), "!");
assert_eq!(gpt2_vocab.id_to_token(&(2_i64)), "<|endoftext|>");
drop(path);
Ok(())
} | rust_cleaned_test_functions.jsonl/51612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
28838,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
442,
286,
16246,
198,
286,
1077,
5206,
23820,
2458,
284,
54819,
486,
15810,
12151,
1703,
486,
931,
94136,
286,
3270,
33673,
310,
23820,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse_reference_test() {
assert_matches!("parent".parse::<OfferFromRef>(), Ok(OfferFromRef::Parent));
assert_matches!("framework".parse::<OfferFromRef>(), Ok(OfferFromRef::Framework));
assert_matches!("self".parse::<OfferFromRef>(), Ok(OfferFromRef::Self_));
assert_matches!("#child".parse::<OfferFromRef>(), Ok(OfferFromRef::Named(name)) if name == "child");
assert_matches!("invalid".parse::<OfferFromRef>(), Err(_));
assert_matches!("#invalid-child^".parse::<OfferFromRef>(), Err(_));
} | rust_cleaned_test_functions.jsonl/34905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25433,
4452,
368,
341,
286,
2060,
38344,
17223,
3765,
3263,
6400,
27638,
39462,
3830,
3945,
39019,
7622,
19238,
2945,
3830,
3945,
486,
8387,
1106,
286,
2060,
38344,
17223,
3794,
3263,
6400,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_conv_2() {
let conv = make_conv(1, 1, PaddingSpec::SameUpper);
let data = rctensor4(&[[[[142.3088f32], [48.891083]], [[208.3187], [-11.274994]]]]);
let filter =
rctensor4(&[[[[160.72833f32]], [[107.84076]]], [[[247.50552]], [[-38.738464]]]]);
let exp = rctensor4(&[[[[80142.31f32], [5067.5586]], [[32266.81], [-1812.2109]]]]);
let got = &conv.eval(tvec![data, filter]).unwrap()[0];
exp.close_enough(&got, true).unwrap()
} | rust_cleaned_test_functions.jsonl/6396 | {
"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,
22716,
62,
17,
368,
341,
286,
1077,
5686,
284,
1281,
22716,
7,
16,
11,
220,
16,
11,
23024,
8327,
486,
19198,
14251,
317,
286,
1077,
821,
284,
435,
302,
3805,
19,
2099,
15505,
15505,
16,
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_drain_after_limit() {
let src_exec = MockExecutor::new(
vec![FieldTypeTp::LongLong.into()],
vec![
BatchExecuteResult {
physical_columns: QuiesceBatchColumnVec::from(vec![VectorValue::Int(
vec![Some(-5), Some(-1), None].into(),
)]),
logical_rows: vec![1, 2],
warnings: EvalWarnings::default(),
is_drained: Ok(false),
},
BatchExecuteResult {
physical_columns: QuiesceBatchColumnVec::empty(),
logical_rows: Vec::new(),
warnings: EvalWarnings::default(),
is_drained: Ok(false),
},
BatchExecuteResult {
physical_columns: QuiesceBatchColumnVec::from(vec![VectorValue::Int(
vec![None, Some(50), None, None, Some(1)].into(),
)]),
logical_rows: vec![0, 4, 1, 3],
warnings: EvalWarnings::default(),
is_drained: Ok(true),
},
],
);
let mut exec = BatchLimitExecutor::new(src_exec, 4).unwrap();
let r = exec.next_batch(1);
assert_eq!(&r.logical_rows, &[1, 2]);
assert_eq!(r.physical_columns.rows_len(), 3);
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert_eq!(r.physical_columns.rows_len(), 0);
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert_eq!(&r.logical_rows, &[0, 4]);
assert_eq!(r.physical_columns.rows_len(), 5);
assert!(r.is_drained.unwrap());
} | rust_cleaned_test_functions.jsonl/49578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1047
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
466,
19844,
14763,
368,
341,
286,
1077,
2286,
18430,
284,
14563,
25255,
486,
931,
1006,
310,
7486,
20703,
63733,
62241,
486,
6583,
6583,
39860,
73845,
310,
7486,
90515,
394,
33904,
17174,
207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_write() {
let data = b"GET /index.php HTTP/1.1\r\n\r\n";
let gap = 10;
let mut buffer = Vec::new();
let mut writer = Writer::new(&mut buffer).expect("failed to create writer");
writer.parse(Direction::ToServer, data).unwrap();
writer.gap(Direction::ToServer, gap).unwrap();
let buffer = std::io::Cursor::new(buffer);
let reader = Reader::new(buffer).expect("failed to create reader");
let result: Vec<Call> = reader.collect();
let expected: Vec<Call> = vec![
Call::Parse(Data {
direction: Direction::ToServer,
data: data.to_vec(),
}),
Call::Gap(Gap {
direction: Direction::ToServer,
gap,
}),
];
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/21365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
9165,
368,
341,
286,
1077,
821,
284,
293,
1,
3806,
608,
1252,
2296,
10130,
14,
16,
13,
16,
12016,
1699,
12016,
1699,
876,
286,
1077,
12929,
284,
220,
16,
15,
401,
286,
1077,
5206,
4147,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_citext_params() {
let mut runtime = Runtime::new().unwrap();
let handshake = connect("user=postgres");
let (mut client, connection) = runtime.block_on(handshake).unwrap();
let connection = connection.map_err(|e| panic!("{}", e));
runtime.spawn(connection);
let batch = client
.simple_query(
"CREATE TEMPORARY TABLE foo (
id SERIAL PRIMARY KEY,
b CITEXT
)",
)
.for_each(|_| Ok(()));
runtime.block_on(batch).unwrap();
let prepare = client.prepare("INSERT INTO foo (b) VALUES ($1), ($2), ($3)");
let stmt = runtime.block_on(prepare).unwrap();
let execute = client.execute(&stmt, &[&"foobar", &"FooBar", &None::<&'static str>]);
runtime.block_on(execute).unwrap();
let prepare = client.prepare("SELECT b FROM foo WHERE b = 'FOOBAR' ORDER BY id");
let stmt = runtime.block_on(prepare).unwrap();
let query = client.query(&stmt, &[]).collect();
let res = runtime.block_on(query).unwrap();
assert_eq!(
vec!["foobar".to_string(), "FooBar".to_string()],
res.iter()
.map(|row| row.get::<_, String>(0))
.collect::<Vec<_>>()
);
} | rust_cleaned_test_functions.jsonl/127914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 548
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
275,
427,
6745,
368,
341,
262,
1077,
5206,
15592,
284,
10954,
486,
931,
1005,
15454,
1428,
262,
1077,
57020,
284,
4564,
445,
872,
28,
43070,
797,
262,
1077,
320,
6984,
2943,
11,
3633,
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... | 1 |
#[test]
fn test_zero_timeout() {
// Create runtime and mempool notifier
let runtime = create_runtime();
let _enter = runtime.enter();
let (mempool_notifier, _mempool_listener) = crate::new_mempool_notifier_listener_pair();
let notify_result =
block_on(mempool_notifier.notify_new_commit(vec![create_user_transaction()], 0, 0));
assert_matches!(notify_result, Err(Error::TimeoutWaitingForMempool));
} | rust_cleaned_test_functions.jsonl/24570 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
20537,
368,
341,
286,
442,
4230,
15592,
323,
1833,
10285,
73169,
198,
286,
1077,
15592,
284,
1855,
33232,
543,
286,
1077,
716,
1950,
284,
15592,
35690,
543,
286,
1077,
320,
76,
3262,
1749,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_260() {
assert_eq!(Solution::single_number(vec![1, 2, 1, 3, 2, 5]), vec![3, 5]);
assert_eq!(Solution::single_number(vec![0, 1]), vec![1, 0]);
} | rust_cleaned_test_functions.jsonl/19711 | {
"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,
62,
17,
21,
15,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
15338,
5500,
25592,
20703,
16,
11,
220,
17,
11,
220,
16,
11,
220,
18,
11,
220,
17,
11,
220,
20,
9719,
7486,
20703,
18,
11,
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_cell() {
let b = TableCell::new().build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:tc><w:tcPr /><w:p w14:paraId="12345678"><w:pPr><w:rPr /></w:pPr></w:p></w:tc>"#
);
} | rust_cleaned_test_functions.jsonl/95180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16648,
368,
341,
286,
1077,
293,
284,
84370,
486,
931,
1005,
5834,
543,
286,
2060,
10714,
33673,
310,
607,
486,
1499,
39453,
23,
2099,
65,
568,
15454,
3148,
310,
435,
2,
22476,
86,
25,
10413,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let data: Vec<u8> = vec![1, 2, 3];
let prefix = Prefix {
version: Version::V0,
codec: Codec::DagProtobuf,
mh_type: multihash::Code::Sha2_256,
mh_len: 32,
};
let mut map = HashMap::new();
let cid = Cid::new_from_prefix(&prefix, &data);
map.insert(cid.clone(), data.clone());
assert_eq!(&data, map.get(&cid).unwrap());
} | rust_cleaned_test_functions.jsonl/79688 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
368,
341,
262,
1077,
821,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
935,
262,
1077,
9252,
284,
56483,
341,
286,
2319,
25,
6079,
486,
53,
15,
345,
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_intraday_chart_400_failed() {
let it = crawler::IntradayBuilder::default().build();
assert_err!(it.chart("").call(), Err(FugleError::General(_)));
} | rust_cleaned_test_functions.jsonl/49439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
47026,
352,
40961,
62,
19,
15,
15,
35060,
368,
341,
262,
1077,
432,
284,
73094,
486,
641,
47026,
352,
3297,
486,
2258,
1005,
5834,
543,
262,
2060,
9266,
10297,
275,
30672,
80821,
6659,
150... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_succeed_if_rustup_sh_already_installed_env_var_set() {
clitools::setup(Scenario::SimpleV2, &|config| {
config.create_rustup_sh_metadata();
let out = run(
config,
"rustup-init",
&["-y", "--no-modify-path"],
&[("RUSTUP_INIT_SKIP_EXISTENCE_CHECKS", "yes")],
);
assert!(out.ok);
assert!(!out
.stderr
.contains("warning: it looks like you have existing rustup.sh metadata"));
assert!(!out
.stderr
.contains("error: cannot install while rustup.sh is installed"));
assert!(!out.stderr.contains(
"warning: continuing (because the -y flag is set and the error is ignorable)"
));
assert!(!out.stdout.contains("Continue? (y/N)"));
})
} | rust_cleaned_test_functions.jsonl/58307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
29264,
11119,
1710,
590,
454,
3712,
80772,
79065,
15879,
4612,
2602,
368,
341,
262,
91762,
6178,
486,
15188,
7,
54031,
486,
16374,
53,
17,
11,
609,
91,
1676,
91,
341,
286,
2193,
2520,
1710,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_empty() -> anyhow::Result<()> {
let empty = SnapshotTasks(vec![]);
assert_eq!(serde_json::to_vec(&empty)?, b"{}".to_owned());
Ok(())
} | rust_cleaned_test_functions.jsonl/47458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
15124,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
4287,
284,
68697,
25449,
25592,
0,
56703,
286,
2060,
10714,
10297,
47024,
9455,
486,
983,
13251,
2099,
3194,
11843,
11,
293,
1,
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
] | 2 |
#[test]
fn test_00EE() {
// 0x00EE - Return from a subroutine
let opcode = 0x00EE;
let mut vm = get_vm();
vm.stack[0x0] = 0x200;
vm.stack_pointer = 1;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.program_counter, 0x200);
assert_eq!(vm.stack_pointer, 0);
} | rust_cleaned_test_functions.jsonl/240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
15,
7099,
368,
341,
262,
442,
220,
15,
87,
15,
15,
7099,
481,
3411,
504,
264,
88334,
271,
262,
1077,
30028,
284,
220,
15,
87,
15,
15,
7099,
280,
262,
1077,
5206,
10995,
284,
633,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rect_sides() {
let rect = Rect::new(0, 0, 20, 20);
let sides = rect.sides();
assert_eq!(
sides,
vec![
Segment {
point: (0., 0.),
vector: Vector2D { x: 0., y: 20. },
},
Segment {
point: (0., 20.),
vector: Vector2D { x: 20., y: 0. },
},
Segment {
point: (20., 20.),
vector: Vector2D { x: 0., y: -20. },
},
Segment {
point: (20., 0.),
vector: Vector2D { x: -20., y: 0. },
}
]
);
} | rust_cleaned_test_functions.jsonl/110311 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 522
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16979,
643,
3341,
368,
341,
286,
1077,
7608,
284,
11920,
486,
931,
7,
15,
11,
220,
15,
11,
220,
17,
15,
11,
220,
17,
15,
317,
286,
1077,
11067,
284,
7608,
514,
3341,
1428,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_munmap() {
serial_test(|| {
with_cleanup(
|| {
let res = dzmmap_noreplace(START, BYTES_IN_PAGE);
assert!(res.is_ok());
let res = munmap(START, BYTES_IN_PAGE);
assert!(res.is_ok());
},
|| {
assert!(munmap(START, BYTES_IN_PAGE).is_ok());
},
)
})
} | rust_cleaned_test_functions.jsonl/107210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
359,
2186,
368,
341,
286,
6146,
4452,
79453,
341,
310,
448,
42444,
1006,
394,
1369,
341,
503,
1077,
592,
284,
25718,
76,
2186,
1089,
460,
2007,
7,
22564,
11,
7710,
28484,
2158,
19971,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_touch_enter_event() {
let event: TouchEnter = js!(
return new TouchEvent( @{TouchEnter::EVENT_TYPE} );
).try_into().unwrap();
assert_eq!( event.event_type(), TouchEnter::EVENT_TYPE );
} | rust_cleaned_test_functions.jsonl/86596 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60840,
37480,
6748,
368,
341,
286,
1077,
1538,
25,
19338,
6269,
284,
6994,
33673,
310,
470,
501,
19338,
1556,
7,
33267,
11309,
6269,
486,
37349,
4189,
92,
1439,
286,
7457,
1539,
45514,
1005,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_binaryserializer_write_field_and_value() {
let field_header = FieldHeader {
type_code: -2,
field_code: 0,
};
let field_info = FieldInfo {
nth: 0,
is_vl_encoded: false,
is_serialized: false,
is_signing_field: false,
r#type: "Unknown".to_string(),
};
let field_instance = FieldInstance::new(&field_info, "Generic", field_header);
let expected: Vec<u8> = [255, 224, 0, 17, 34].to_vec();
let test_bytes: Vec<u8> = [0, 17, 34].to_vec();
let mut serializer: BinarySerializer = BinarySerializer::new();
serializer.write_field_and_value(field_instance, &test_bytes);
assert_eq!(expected, serializer);
} | rust_cleaned_test_functions.jsonl/20422 | {
"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,
31761,
52718,
9165,
5013,
8378,
3142,
368,
341,
286,
1077,
2070,
8757,
284,
8601,
4047,
341,
310,
943,
4136,
25,
481,
17,
345,
310,
2070,
4136,
25,
220,
15,
345,
286,
3634,
286,
1077,
2070,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drachm() {
assert_query!("(1gr * 27.34375) to dr", 1, dr);
assert_query!("(1lb / 256) to dr", 1, dr);
} | rust_cleaned_test_functions.jsonl/36183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
610,
76,
368,
341,
262,
2060,
5738,
17223,
7,
16,
901,
353,
220,
17,
22,
13,
18,
19,
18,
22,
20,
8,
311,
1353,
497,
220,
16,
11,
1353,
317,
262,
2060,
5738,
17223,
7,
16,
21123,
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 |
#[test]
fn test_plus_and_times() {
let bank = default_bank();
let sum = dollar(5.0).plus(franc(10.0));
let mul = sum.times(3.0);
assert_eq!(dollar(30.0), bank.reduce(&mul, "USD"));
} | rust_cleaned_test_functions.jsonl/133367 | {
"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,
28043,
8378,
22353,
368,
341,
286,
1077,
6073,
284,
1638,
35733,
543,
286,
1077,
2629,
284,
17692,
7,
20,
13,
15,
568,
7138,
74312,
1129,
7,
16,
15,
13,
15,
1106,
286,
1077,
15602,
284,
2629,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sqlite_functions() {
let db = checked_memory_handle();
let result: Result<NaiveTime> =
db.query_row("SELECT CURRENT_TIME", NO_PARAMS, |r| r.get(0));
assert!(result.is_ok());
let result: Result<NaiveDate> =
db.query_row("SELECT CURRENT_DATE", NO_PARAMS, |r| r.get(0));
assert!(result.is_ok());
let result: Result<NaiveDateTime> =
db.query_row("SELECT CURRENT_TIMESTAMP", NO_PARAMS, |r| r.get(0));
assert!(result.is_ok());
let result: Result<DateTime<Utc>> =
db.query_row("SELECT CURRENT_TIMESTAMP", NO_PARAMS, |r| r.get(0));
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/15054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18063,
632,
31708,
368,
341,
286,
1077,
2927,
284,
10067,
19195,
10630,
543,
286,
1077,
1102,
25,
5714,
27,
16193,
533,
1462,
29,
4035,
310,
2927,
4786,
8530,
445,
4858,
43107,
10051,
497,
5664,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_need_fetch_for_qc() {
let block_tree = build_empty_tree();
let mut inserter = TreeInserter::new(block_tree.clone());
// build a tree of the following form
// genesis <- a1 <- a2 <- a3
let genesis = block_tree.root();
let a1 =
inserter.insert_block_with_qc(QuorumCert::certificate_for_genesis(), genesis.as_ref(), 1);
let a2 = inserter.insert_block(a1.as_ref(), 2);
let a3 = inserter.insert_block(a2.as_ref(), 3);
block_tree.prune_tree(a2.id());
let need_fetch_qc = placeholder_certificate_for_block(
vec![block_tree.signer()],
HashValue::zero(),
a3.round() + 1,
HashValue::zero(),
a3.round(),
HashValue::zero(),
a3.round() - 1,
);
let too_old_qc = QuorumCert::certificate_for_genesis();
let can_insert_qc = placeholder_certificate_for_block(
vec![block_tree.signer()],
a3.id(),
a3.round(),
a2.id(),
a2.round(),
a1.id(),
a1.round(),
);
let duplicate_qc = block_tree.get_quorum_cert_for_block(a2.id()).unwrap();
assert_eq!(
block_tree.need_fetch_for_quorum_cert(&need_fetch_qc),
NeedFetchResult::NeedFetch
);
assert_eq!(
block_tree.need_fetch_for_quorum_cert(&too_old_qc),
NeedFetchResult::QCRoundBeforeRoot,
);
assert_eq!(
block_tree.need_fetch_for_quorum_cert(&can_insert_qc),
NeedFetchResult::QCBlockExist,
);
assert_eq!(
block_tree.need_fetch_for_quorum_cert(duplicate_qc.as_ref()),
NeedFetchResult::QCAlreadyExist,
);
} | rust_cleaned_test_functions.jsonl/85845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 792
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71506,
11803,
5478,
8976,
66,
368,
341,
262,
1077,
2504,
11663,
284,
1936,
15124,
11663,
543,
262,
1077,
5206,
47325,
465,
284,
8942,
641,
90727,
486,
931,
18682,
11663,
15997,
5231,
262,
442,
193... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_non_wrapping() {
// Move by 1 position
// List length of 1
assert_eq!(0, Movement::Up.update_index(0, 1, 1, false));
assert_eq!(0, Movement::Down.update_index(0, 1, 1, false));
// List length of 5
assert_eq!(0, Movement::Up.update_index(0, 5, 1, false));
assert_eq!(1, Movement::Down.update_index(0, 5, 1, false));
// Move by 2 positions
// List length of 1
assert_eq!(0, Movement::Up.update_index(0, 1, 2, false));
assert_eq!(0, Movement::Down.update_index(0, 1, 2, false));
// List length of 5
assert_eq!(0, Movement::Up.update_index(0, 5, 2, false));
assert_eq!(2, Movement::Down.update_index(0, 5, 2, false));
} | rust_cleaned_test_functions.jsonl/31800 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
44074,
3629,
368,
341,
286,
442,
14561,
553,
220,
16,
2309,
198,
286,
442,
1759,
3084,
315,
220,
16,
198,
286,
2060,
10714,
10297,
15,
11,
27998,
486,
2324,
5317,
3560,
7,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_string_value() {
assert_eq!(
AMQPValue::try_from(&Value::String(String::new()), AMQPType::LongString),
Some(AMQPValue::LongString(LongString::default()))
);
assert_eq!(
AMQPValue::try_from(&Value::String("test".to_string()), AMQPType::LongString),
Some(AMQPValue::LongString("test".into()))
);
} | rust_cleaned_test_functions.jsonl/115692 | {
"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,
5673,
3904,
3142,
368,
341,
286,
2060,
10714,
33673,
310,
6769,
66520,
1130,
486,
1539,
5673,
2099,
1130,
486,
703,
2242,
486,
931,
11858,
6769,
66520,
929,
486,
6583,
703,
1326,
310,
4329,
7,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_barbell_graph() -> Result<()> {
let mut barbell_graph = Graph::generate_barbell_graph(
None,
Some(100), // 9900 edges
Some(100), // 198 edges
Some(100), // 9900 edges
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
)
.unwrap();
assert!(barbell_graph.is_connected(Some(true)));
let chains = barbell_graph.get_chains(None, None).unwrap();
assert_eq!(chains.len(), 1);
assert_eq!(chains[0].len(), 100);
let _ = graph::test_utilities::default_test_suite(&mut barbell_graph, None);
Ok(())
} | rust_cleaned_test_functions.jsonl/134545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14388,
17250,
14738,
368,
1464,
5714,
71698,
341,
262,
1077,
5206,
3619,
17250,
14738,
284,
12165,
486,
19366,
14388,
17250,
14738,
1006,
286,
2240,
345,
286,
4329,
7,
16,
15,
15,
701,
442,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_thinness() {
assert_eq!(
core::mem::size_of::<ThinStr>(),
core::mem::size_of::<usize>()
);
assert_eq!(
core::mem::size_of::<Option<ThinStr>>(),
core::mem::size_of::<usize>()
);
} | rust_cleaned_test_functions.jsonl/59274 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5854,
70673,
368,
341,
286,
2060,
10714,
33673,
310,
6200,
486,
10536,
486,
2141,
3575,
27638,
93088,
2580,
65766,
310,
6200,
486,
10536,
486,
2141,
3575,
27638,
51878,
18949,
286,
1439,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rename_failure() {
let test_writeable = TestWriteable{};
let filename = "test_rename_failure_filename";
let path = PathBuf::from("test_rename_failure_dir");
// Create the channel data file and make it a directory.
fs::create_dir_all(get_full_filepath(path.clone(), filename.to_string())).unwrap();
match write_to_file(path.clone(), filename.to_string(), &test_writeable) {
Err(e) => assert_eq!(e.kind(), io::ErrorKind::Other),
_ => panic!("Unexpected Ok(())")
}
fs::remove_dir_all(path).unwrap();
} | rust_cleaned_test_functions.jsonl/125736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79399,
43618,
368,
341,
197,
10217,
1273,
9165,
480,
284,
3393,
7985,
480,
45982,
197,
10217,
3899,
284,
330,
1944,
79399,
43618,
13323,
876,
197,
10217,
1815,
284,
7933,
15064,
486,
1499,
445,
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... | 2 |
#[test]
fn test_add() {
let a = Affine::new(
field_element!("01ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca"),
field_element!("005668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"),
);
let b = Affine::new(
field_element!("00f24921907180cd42c9d2d4f9490a7bc19ac987242e80ac09a8ac2bcf0445de"),
field_element!("018a7a2ab4e795405f924de277b0e723d90eac55f2a470d8532113d735bdedd4"),
);
let c = Affine::new(
field_element!("0457342950d2475d9e83a4de8beb3c0850181342ea04690d804b37aa907b735f"),
field_element!("00011bd6102b929632ce605b5ae1c9c6c1b8cba2f83aa0c5a6d1247318871137"),
);
assert_eq!(a + b, c);
} | rust_cleaned_test_functions.jsonl/107418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
368,
341,
286,
1077,
264,
284,
9748,
482,
486,
931,
1006,
310,
2070,
7894,
17223,
15,
16,
823,
16,
20,
66,
16,
23,
20,
24,
24,
24,
22,
16,
65,
22,
16692,
291,
19,
16,
20,
64,
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_write_bytes() {
let mut b = BooleanBufferBuilder::new(4);
b.append(false).unwrap();
b.append(true).unwrap();
b.append(false).unwrap();
b.append(true).unwrap();
assert_eq!(4, b.len());
assert_eq!(512, b.capacity());
let buffer = b.finish();
assert_eq!(1, buffer.len());
let mut b = BooleanBufferBuilder::new(4);
b.append_slice(&[false, true, false, true]).unwrap();
assert_eq!(4, b.len());
assert_eq!(512, b.capacity());
let buffer = b.finish();
assert_eq!(1, buffer.len());
} | rust_cleaned_test_functions.jsonl/30967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
12524,
368,
341,
286,
1077,
5206,
293,
284,
6992,
4095,
3297,
486,
931,
7,
19,
317,
286,
293,
2057,
3576,
568,
15454,
543,
286,
293,
2057,
3715,
568,
15454,
543,
286,
293,
2057,
3576,
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_unsuback() {
let packet = Packet::Unsuback(Pid::try_from(19).unwrap());
assert_decode_slice!(Packet::Unsuback(_), &packet, 4);
} | rust_cleaned_test_functions.jsonl/59356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
1966,
473,
368,
341,
262,
1077,
10151,
284,
28889,
486,
1806,
1966,
473,
5304,
307,
486,
1539,
5673,
7,
16,
24,
568,
15454,
1423,
1066,
262,
2060,
15227,
26488,
10297,
16679,
486,
1806,
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 |
#[test]
fn test_bounds_on_skipped() {
#![allow(dead_code)]
use std::{fmt::*, marker::PhantomData};
struct NoDebug;
struct TemplatedType<T> {
_phantom: PhantomData<T>,
};
impl<T> Debug for TemplatedType<T>
where
T: Debug,
{
fn fmt(&self, f: &mut Formatter) -> Result {
write!(f, "TemplatedType")
}
}
test_derive! {
custom_debug_derive {
struct WantDebug<T> {
foo: TemplatedType<T>,
#[debug(skip)]
bar: Debug,
}
}
expands to {
#[allow(non_upper_case_globals)]
const _DERIVE_core_fmt_Debug_FOR_WantDebug: () = {
impl<T> ::core::fmt::Debug for WantDebug<T>
where
TemplatedType<T>: ::core::fmt::Debug
{
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
WantDebug { foo: ref __binding_0, .. } => {
let mut s = f.debug_struct("WantDebug");
s.field("foo", __binding_0);
s.finish()
}
}
}
}
};
}
no_build
}
} | rust_cleaned_test_functions.jsonl/61113 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 877
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36878,
4470,
33811,
6450,
368,
341,
262,
671,
20703,
7183,
83207,
4136,
27771,
262,
990,
1460,
22964,
12501,
486,
12314,
11134,
486,
3357,
30002,
1043,
2315,
262,
2036,
2308,
7939,
280,
262,
2036,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_deserialize() {
let proof = create_default_proof();
let serialized = proof.to_string().unwrap();
let proof2 = ProofMessage::from_str(&serialized).unwrap();
assert_eq!(proof, proof2);
} | rust_cleaned_test_functions.jsonl/74789 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
15768,
9050,
368,
341,
286,
1077,
11064,
284,
1855,
9993,
86757,
543,
286,
1077,
32916,
284,
11064,
2389,
3904,
1005,
15454,
543,
286,
1077,
11064,
17,
284,
36991,
2052,
486,
1499,
2895,
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 |
#[test]
fn test_neuron_spawn_partial_exact() {
assert_neuron_spawn_partial(240_000_000, 60, 144_000_000, 96_000_000);
} | rust_cleaned_test_functions.jsonl/42938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 60
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
36090,
76026,
52068,
71084,
368,
341,
262,
2060,
13925,
36090,
76026,
52068,
7,
17,
19,
15,
62,
15,
15,
15,
62,
15,
15,
15,
11,
220,
21,
15,
11,
220,
16,
19,
19,
62,
15,
15,
15,
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 |
#[test]
fn test_source_uri_from_str_http_with_git_extension() {
assert_source_uri_from_str(
"https://github.com/ffizer/ffizer.git",
"ffizer/ffizer",
Some("github.com"),
);
assert_source_uri_from_str(
"http://github.com/ffizer/ffizer.git",
"ffizer/ffizer",
Some("github.com"),
);
} | rust_cleaned_test_functions.jsonl/104987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10347,
15572,
5673,
2895,
25888,
6615,
68801,
31035,
368,
341,
286,
2060,
10347,
15572,
5673,
2895,
1006,
310,
330,
2428,
1110,
5204,
905,
14,
542,
3135,
14,
542,
3135,
32799,
756,
310,
330,
542,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_setup_fpu() {
let hv = hypervisor::new().unwrap();
let vm = hv.create_vm().expect("new VM fd creation failed");
let vcpu = vm.create_vcpu(0, None).unwrap();
setup_fpu(&vcpu).unwrap();
let expected_fpu: FpuState = FpuState {
fcw: 0x37f,
mxcsr: 0x1f80,
..Default::default()
};
let actual_fpu: FpuState = vcpu.get_fpu().unwrap();
// TODO: auto-generate kvm related structures with PartialEq on.
assert_eq!(expected_fpu.fcw, actual_fpu.fcw);
// Setting the mxcsr register from FpuState inside setup_fpu does not influence anything.
// The mxcsr will stay 0 and the assert below fails. Decide whether or not we should
// remove it at all.
} | rust_cleaned_test_functions.jsonl/38424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21363,
761,
5584,
368,
341,
286,
1077,
22747,
284,
9751,
31396,
486,
931,
1005,
15454,
543,
286,
1077,
10995,
284,
22747,
2520,
39008,
1005,
17119,
445,
931,
17792,
12414,
9688,
4641,
797,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_hex_digit() {
for val in u8::min_value()..=u8::max_value() {
let char = char::from(val);
let is_in_small = ('a'..='f').contains(&char);
let is_in_large = ('A'..='F').contains(&char);
let is_in_dec_digit = ('0'..='9').contains(&char);
let expected_result = is_in_small || is_in_large || is_in_dec_digit;
assert_eq!(is_hex_digit(char),expected_result);
}
} | rust_cleaned_test_functions.jsonl/35025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
32655,
48403,
368,
341,
286,
369,
1044,
304,
575,
23,
486,
1065,
3142,
368,
496,
28,
84,
23,
486,
2810,
3142,
368,
341,
310,
1077,
1161,
310,
284,
1161,
486,
1499,
9098,
317,
310,
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... | 4 |
#[test]
fn test_puzzle_example_part_two() {
let contents = String::from("00100\n11110\n10110\n10111\n10101\n01111\n00111\n11100\n10000\n11001\n00010\n01010");
assert_eq!("230", solve_puzzle(2, contents));
} | rust_cleaned_test_functions.jsonl/3586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
14945,
39304,
10495,
23241,
368,
341,
286,
1077,
8794,
284,
923,
486,
1499,
445,
15,
15,
16,
15,
15,
1699,
16,
16,
16,
16,
15,
1699,
16,
15,
16,
16,
15,
1699,
16,
15,
16,
16,
16,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.