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_eval_let_rec() {
use moniker::FreeVar;
let x1 = FreeVar::fresh_named("x");
let x2 = FreeVar::fresh_named("x");
let test = FreeVar::fresh_named("test");
let id = FreeVar::fresh_named("id");
// expr =
// let test = id x
// id = \x -> x
// in
// test
let expr = RcExpr::from(Expr::LetRec(Scope::new(
Rec::new(vec![
(
Binder(test.clone()),
Embed(RcExpr::from(Expr::App(
RcExpr::from(Expr::Var(Var::Free(id.clone()))),
RcExpr::from(Expr::Var(Var::Free(x1.clone()))),
))),
),
(
Binder(id.clone()),
Embed(RcExpr::from(Expr::Lam(Scope::new(
Binder(x2.clone()),
RcExpr::from(Expr::Var(Var::Free(x2.clone()))),
)))),
),
]),
RcExpr::from(Expr::Var(Var::Free(test.clone()))),
)));
assert_term_eq!(eval(&expr), RcExpr::from(Expr::Var(Var::Free(x1.clone()))));
} | rust_cleaned_test_functions.jsonl/33405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 651
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
62,
1149,
7080,
368,
341,
262,
990,
1615,
24803,
486,
10940,
3962,
401,
262,
1077,
856,
16,
284,
3574,
3962,
486,
71308,
71834,
445,
87,
797,
262,
1077,
856,
17,
284,
3574,
3962,
486,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_permitted_characters() {
let mut good_chars = (0x20..=0x7E).collect::<Vec<u8>>();
good_chars.push(0x0A); // \n
good_chars.push(0x09); // \t
for c in good_chars {
assert!(super::is_permitted_char(c as char));
}
} | rust_cleaned_test_functions.jsonl/112040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31961,
3762,
79060,
368,
341,
286,
1077,
5206,
1661,
37418,
284,
320,
15,
87,
17,
15,
496,
28,
15,
87,
22,
36,
568,
17384,
27638,
10050,
34837,
23,
37038,
286,
1661,
37418,
2552,
7,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_lpad() {
let mut cases = vec![
(
Some(b"hello".to_vec()),
Some(0),
Some(b"h".to_vec()),
Some(b"".to_vec()),
),
(
Some(b"hello".to_vec()),
Some(1),
Some(b"h".to_vec()),
Some(b"h".to_vec()),
),
(Some(b"hello".to_vec()), Some(-1), Some(b"h".to_vec()), None),
(
Some(b"hello".to_vec()),
Some(3),
Some(b"".to_vec()),
Some(b"hel".to_vec()),
),
(Some(b"hello".to_vec()), Some(8), Some(b"".to_vec()), None),
(
Some(b"hello".to_vec()),
Some(8),
Some(b"he".to_vec()),
Some(b"hehhello".to_vec()),
),
(
Some(b"hello".to_vec()),
Some(9),
Some(b"he".to_vec()),
Some(b"hehehello".to_vec()),
),
(
Some(b"hello".to_vec()),
Some(5),
Some("您好".as_bytes().to_vec()),
Some(b"hello".to_vec()),
),
(Some(b"hello".to_vec()), Some(6), Some(b"".to_vec()), None),
(
Some(b"\x61\x76\x5e".to_vec()),
Some(2),
Some(b"\x35".to_vec()),
Some(b"\x61\x76".to_vec()),
),
(
Some(b"\x61\x76\x5e".to_vec()),
Some(5),
Some(b"\x35".to_vec()),
Some(b"\x35\x35\x61\x76\x5e".to_vec()),
),
(
Some(b"hello".to_vec()),
Some(i64::from(MAX_BLOB_WIDTH) + 1),
Some(b"he".to_vec()),
None,
),
(None, Some(-1), Some(b"h".to_vec()), None),
(None, None, None, 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::Lpad)
.unwrap();
assert_eq!(output, expect_output);
}
} | rust_cleaned_test_functions.jsonl/10162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1643
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
13242,
368,
341,
286,
1077,
5206,
5048,
284,
7486,
90515,
310,
2399,
394,
4329,
1883,
1,
14990,
3263,
983,
13251,
14702,
394,
4329,
7,
15,
1326,
394,
4329,
1883,
78522,
3263,
983,
13251,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_make_target() {
let nodename = DomainBuilder::from_str("foo._fuchsia._udp.local").unwrap();
let record = RecordBuilder::new(nodename, Type::A, Class::Any, true, 4500, &[8, 8, 8, 8]);
let mut message = MessageBuilder::new(0, true);
message.add_additional(record);
let mut msg_bytes = message
.into_serializer()
.serialize_vec_outer()
.unwrap_or_else(|_| panic!("failed to serialize"));
let parsed = msg_bytes.parse::<Message<_>>().expect("failed to parse");
let addr: SocketAddr = (MDNS_MCAST_V4, 12).into();
let (t, ttl) = make_target(addr.clone(), parsed).unwrap();
assert_eq!(ttl, 4500);
assert_eq!(
t.addresses.as_ref().unwrap()[0],
bridge::TargetAddrInfo::Ip(bridge::TargetIp {
ip: IpAddress::Ipv4(Ipv4Address { addr: MDNS_MCAST_V4.octets().into() }),
scope_id: 0
})
);
assert_eq!(t.nodename.unwrap(), "foo._fuchsia._udp");
} | rust_cleaned_test_functions.jsonl/15631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
11123,
368,
341,
286,
1077,
16004,
1840,
284,
21070,
3297,
486,
1499,
2895,
445,
7975,
1436,
69,
73391,
1436,
31101,
11033,
1827,
15454,
543,
286,
1077,
3255,
284,
13583,
3297,
486,
931,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_schema_with_currently_parsing_schema_named_record() {
let schema = Schema::parse_str(
r#"
{
"type" : "record",
"name" : "record",
"fields" : [
{ "name" : "value", "type" : "long" },
{ "name" : "next", "type" : "record" }
]
}
"#,
)
.unwrap();
let mut lookup = HashMap::new();
lookup.insert("value".to_owned(), 0);
lookup.insert("next".to_owned(), 1);
let expected = Schema::Record {
name: Name {
name: "record".to_owned(),
namespace: None,
aliases: None,
},
doc: None,
fields: vec![
RecordField {
name: "value".to_string(),
doc: None,
default: None,
schema: Schema::Long,
order: RecordFieldOrder::Ascending,
position: 0,
},
RecordField {
name: "next".to_string(),
doc: None,
default: None,
schema: Schema::Ref {
name: Name {
name: "record".to_owned(),
namespace: None,
aliases: None,
},
},
order: RecordFieldOrder::Ascending,
position: 1,
},
],
lookup,
};
assert_eq!(schema, expected);
let canonical_form = &schema.canonical_form();
let expected = r#"{"name":"record","type":"record","fields":[{"name":"value","type":"long"},{"name":"next","type":"record"}]}"#;
assert_eq!(canonical_form, &expected);
} | rust_cleaned_test_functions.jsonl/116695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
25371,
6615,
11080,
398,
620,
28598,
25371,
71834,
14192,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
1006,
310,
435,
2,
698,
310,
341,
1060,
330,
1313,
1,
549,
330,
8548,
75... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_already_in_use() {
// Attempt to create system account in account already owned by another program
let new_owner = Pubkey::new(&[9; 32]);
let from = solana_sdk::pubkey::new_rand();
let from_account = AccountSharedData::new_ref(100, 0, &system_program::id());
let original_program_owner = Pubkey::new(&[5; 32]);
let owned_key = solana_sdk::pubkey::new_rand();
let owned_account = AccountSharedData::new_ref(0, 0, &original_program_owner);
let unchanged_account = owned_account.clone();
let signers = &[from, owned_key].iter().cloned().collect::<HashSet<_>>();
let owned_address = owned_key.into();
let result = create_account(
&KeyedAccount::new(&from, true, &from_account),
&KeyedAccount::new(&owned_key, false, &owned_account),
&owned_address,
50,
2,
&new_owner,
&signers,
&MockInvokeContext::new(vec![]),
);
assert_eq!(result, Err(SystemError::AccountAlreadyInUse.into()));
let from_lamports = from_account.borrow().lamports;
assert_eq!(from_lamports, 100);
assert_eq!(owned_account, unchanged_account);
// Attempt to create system account in account that already has data
let owned_account = AccountSharedData::new_ref(0, 1, &Pubkey::default());
let unchanged_account = owned_account.borrow().clone();
let result = create_account(
&KeyedAccount::new(&from, true, &from_account),
&KeyedAccount::new(&owned_key, false, &owned_account),
&owned_address,
50,
2,
&new_owner,
&signers,
&MockInvokeContext::new(vec![]),
);
assert_eq!(result, Err(SystemError::AccountAlreadyInUse.into()));
let from_lamports = from_account.borrow().lamports;
assert_eq!(from_lamports, 100);
assert_eq!(*owned_account.borrow(), unchanged_account);
// Attempt to create an account that already has lamports
let owned_account = AccountSharedData::new_ref(1, 0, &Pubkey::default());
let unchanged_account = owned_account.borrow().clone();
let result = create_account(
&KeyedAccount::new(&from, true, &from_account),
&KeyedAccount::new(&owned_key, false, &owned_account),
&owned_address,
50,
2,
&new_owner,
&signers,
&MockInvokeContext::new(vec![]),
);
assert_eq!(result, Err(SystemError::AccountAlreadyInUse.into()));
assert_eq!(from_lamports, 100);
assert_eq!(*owned_account.borrow(), unchanged_account);
} | rust_cleaned_test_functions.jsonl/73043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
80772,
1243,
15951,
368,
341,
286,
442,
43517,
311,
1855,
1849,
2692,
304,
2692,
2669,
12938,
553,
2441,
2025,
198,
286,
1077,
501,
29027,
284,
22611,
792,
486,
931,
2099,
58,
24,
26,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_step_replace_signed() {
let mut x = 4i32;
let y = x.replace_zero();
assert_eq!(x, 0);
assert_eq!(y, 4);
x = 5;
let y = x.replace_one();
assert_eq!(x, 1);
assert_eq!(y, 5);
} | rust_cleaned_test_functions.jsonl/54183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11946,
10633,
55617,
368,
341,
262,
1077,
5206,
856,
284,
220,
19,
72,
18,
17,
280,
262,
1077,
379,
284,
856,
6980,
19359,
543,
262,
2060,
10714,
10297,
87,
11,
220,
15,
317,
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_generic_enum_newtype() {
assert_tokens(
&GenericEnum::NewType::<u32, u32>(5),
&[
Token::NewtypeVariant {
name: "GenericEnum",
variant: "NewType",
},
Token::U32(5),
],
);
} | rust_cleaned_test_functions.jsonl/56430 | {
"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,
41232,
31054,
5921,
1313,
368,
341,
262,
2060,
28838,
1006,
286,
609,
19964,
10766,
486,
3564,
929,
27638,
84,
18,
17,
11,
575,
18,
17,
2235,
20,
1326,
286,
609,
9640,
310,
9660,
486,
3564,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seq_del_item() {
Python::with_gil(|py| {
let v: Vec<i32> = vec![1, 1, 2, 3, 5, 8];
let ob = v.to_object(py);
let seq = ob.cast_as::<PySequence>(py).unwrap();
assert!(seq.del_item(10).is_err());
assert_eq!(1, seq[0].extract::<i32>().unwrap());
assert!(seq.del_item(0).is_ok());
assert_eq!(1, seq[0].extract::<i32>().unwrap());
assert!(seq.del_item(0).is_ok());
assert_eq!(2, seq[0].extract::<i32>().unwrap());
assert!(seq.del_item(0).is_ok());
assert_eq!(3, seq[0].extract::<i32>().unwrap());
assert!(seq.del_item(0).is_ok());
assert_eq!(5, seq[0].extract::<i32>().unwrap());
assert!(seq.del_item(0).is_ok());
assert_eq!(8, seq[0].extract::<i32>().unwrap());
assert!(seq.del_item(0).is_ok());
assert_eq!(0, seq.len().unwrap());
assert!(seq.del_item(0).is_err());
});
} | rust_cleaned_test_functions.jsonl/70314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 589
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
18029,
5634,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
348,
25,
11312,
21897,
18,
17,
29,
284,
7486,
20703,
16,
11,
220,
16,
11,
220,
17,
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... | 1 |
#[test]
fn test_translate_irc_control_chars() {
assert_eq!(
remove_irc_control_chars(" Le Voyageur imprudent "),
" Le Voyageur imprudent "
);
assert_eq!(remove_irc_control_chars("\x0301,02foo"), "foo");
assert_eq!(remove_irc_control_chars("\x0301,2foo"), "foo");
assert_eq!(remove_irc_control_chars("\x031,2foo"), "foo");
assert_eq!(remove_irc_control_chars("\x031,foo"), ",foo");
assert_eq!(remove_irc_control_chars("\x03,foo"), ",foo");
} | rust_cleaned_test_functions.jsonl/6836 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66381,
62,
2437,
13436,
37418,
368,
341,
262,
2060,
10714,
33673,
286,
4057,
62,
2437,
13436,
37418,
445,
220,
220,
219,
2304,
95272,
324,
22540,
4881,
219,
220,
84119,
286,
330,
220,
1967,
95272,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lower() {
let result = lower(to_value("HELLO").unwrap(), HashMap::new());
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value("hello").unwrap());
} | rust_cleaned_test_functions.jsonl/49415 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30425,
368,
341,
286,
1077,
1102,
284,
4722,
12186,
3142,
445,
50712,
1593,
1827,
15454,
1507,
10528,
486,
931,
1423,
286,
2060,
10297,
1382,
2079,
19817,
1423,
286,
2060,
10714,
10297,
1382,
55395,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_one_minus_one_plus_line() {
let config = make_config_from_args(&["--side-by-side", "--width", "40"]);
let output = run_delta(ONE_MINUS_ONE_PLUS_LINE_DIFF, &config);
let output = strip_ansi_codes(&output);
let mut lines = output.lines().skip(7);
assert_eq!("│ 1 │a = 1 │ 1 │a = 1", lines.next().unwrap());
assert_eq!("│ 2 │b = 2 │ 2 │bb = 2", lines.next().unwrap());
} | rust_cleaned_test_functions.jsonl/110579 | {
"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,
11667,
38457,
11667,
28043,
6528,
368,
341,
286,
1077,
2193,
284,
1281,
5332,
5673,
8384,
2099,
1183,
313,
2929,
14319,
24067,
497,
14482,
3098,
497,
330,
19,
15,
15049,
286,
1077,
2550,
284,
1598... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_int() {
assert_eq!(parse_int(FileSpan::new(Rc::new(String::from("4")), Rc::new(String::from("input")))).unwrap().1.value, 4.0);
assert_eq!(parse_int(FileSpan::new(Rc::new(String::from("4350")), Rc::new(String::from("input")))).unwrap().1.value, 4350.0);
assert_eq!(parse_int(FileSpan::new(Rc::new(String::from("-1")), Rc::new(String::from("input")))).unwrap().1.value, -1.0);
assert_eq!(parse_int(FileSpan::new(Rc::new(String::from("0")), Rc::new(String::from("input")))).unwrap().1.value, 0.0);
} | rust_cleaned_test_functions.jsonl/68344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4042,
368,
341,
262,
2060,
10714,
10297,
6400,
4042,
19821,
12485,
486,
931,
2785,
66,
486,
931,
2242,
486,
1499,
445,
19,
35674,
81463,
486,
931,
2242,
486,
1499,
445,
1355,
2761,
4579,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cdc_scan() {
let mut suite = TestSuite::new(1);
let (k, v) = (b"key1".to_vec(), b"value".to_vec());
// Prewrite
let start_ts = suite.cluster.pd_client.get_tso().wait().unwrap();
let mut mutation = Mutation::default();
mutation.set_op(Op::Put);
mutation.key = k.clone();
mutation.value = v.clone();
suite.must_kv_prewrite(1, vec![mutation], k.clone(), start_ts);
// Commit
let commit_ts = suite.cluster.pd_client.get_tso().wait().unwrap();
suite.must_kv_commit(1, vec![k.clone()], start_ts, commit_ts);
// Prewrite again
let start_ts = suite.cluster.pd_client.get_tso().wait().unwrap();
let mut mutation = Mutation::default();
mutation.set_op(Op::Put);
mutation.key = k.clone();
mutation.value = v.clone();
suite.must_kv_prewrite(1, vec![mutation], k.clone(), start_ts);
let mut req = ChangeDataRequest::default();
req.region_id = 1;
req.set_region_epoch(suite.get_context(1).take_region_epoch());
let (req_tx, event_feed_wrap, receive_event) = new_event_feed(suite.get_region_cdc_client(1));
let _req_tx = req_tx.send((req, WriteFlags::default())).wait().unwrap();
let mut events = receive_event(false);
if events.len() == 1 {
events.extend(receive_event(false).into_iter());
}
assert_eq!(events.len(), 2, "{:?}", events);
match events.remove(0).event.unwrap() {
// Batch size is set to 2.
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 2, "{:?}", es);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Prewrite, "{:?}", es);
assert_eq!(e.start_ts, 5, "{:?}", es);
assert_eq!(e.commit_ts, 0, "{:?}", es);
assert_eq!(e.key, k, "{:?}", es);
assert_eq!(e.value, v, "{:?}", es);
let e = &es.entries[1];
assert_eq!(e.get_type(), EventLogType::Committed, "{:?}", es);
assert_eq!(e.start_ts, 3, "{:?}", es);
assert_eq!(e.commit_ts, 4, "{:?}", es);
assert_eq!(e.key, k, "{:?}", es);
assert_eq!(e.value, v, "{:?}", es);
}
Event_oneof_event::Error(e) => panic!("{:?}", e),
Event_oneof_event::ResolvedTs(e) => panic!("{:?}", e),
Event_oneof_event::Admin(e) => panic!("{:?}", e),
}
match events.pop().unwrap().event.unwrap() {
// Then it outputs Initialized event.
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 1, "{:?}", es);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Initialized, "{:?}", es);
}
Event_oneof_event::Error(e) => panic!("{:?}", e),
Event_oneof_event::ResolvedTs(e) => panic!("{:?}", e),
Event_oneof_event::Admin(e) => panic!("{:?}", e),
}
// checkpoint_ts = 6;
let checkpoint_ts = suite.cluster.pd_client.get_tso().wait().unwrap();
// Commit = 7;
let commit_ts = suite.cluster.pd_client.get_tso().wait().unwrap();
suite.must_kv_commit(1, vec![k.clone()], start_ts, commit_ts);
// Prewrite delete
// Start = 8;
let start_ts = suite.cluster.pd_client.get_tso().wait().unwrap();
let mut mutation = Mutation::default();
mutation.set_op(Op::Del);
mutation.key = k.clone();
suite.must_kv_prewrite(1, vec![mutation], k.clone(), start_ts);
let mut req = ChangeDataRequest::default();
req.region_id = 1;
req.checkpoint_ts = checkpoint_ts.into_inner();
req.set_region_epoch(suite.get_context(1).take_region_epoch());
let (req_tx, resp_rx) = suite.get_region_cdc_client(1).event_feed().unwrap();
event_feed_wrap.as_ref().replace(Some(resp_rx));
let _req_tx = req_tx.send((req, WriteFlags::default())).wait().unwrap();
let mut events = receive_event(false);
if events.len() == 1 {
events.extend(receive_event(false).into_iter());
}
assert_eq!(events.len(), 2, "{:?}", events);
match events.remove(0).event.unwrap() {
// Batch size is set to 2.
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 2, "{:?}", es);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Prewrite, "{:?}", es);
assert_eq!(e.get_op_type(), EventRowOpType::Delete, "{:?}", es);
assert_eq!(e.start_ts, 8, "{:?}", es);
assert_eq!(e.commit_ts, 0, "{:?}", es);
assert_eq!(e.key, k, "{:?}", es);
assert!(e.value.is_empty(), "{:?}", es);
let e = &es.entries[1];
assert_eq!(e.get_type(), EventLogType::Committed, "{:?}", es);
assert_eq!(e.get_op_type(), EventRowOpType::Put, "{:?}", es);
assert_eq!(e.start_ts, 5, "{:?}", es);
assert_eq!(e.commit_ts, 7, "{:?}", es);
assert_eq!(e.key, k, "{:?}", es);
assert_eq!(e.value, v, "{:?}", es);
}
Event_oneof_event::Error(e) => panic!("{:?}", e),
Event_oneof_event::ResolvedTs(e) => panic!("{:?}", e),
Event_oneof_event::Admin(e) => panic!("{:?}", e),
}
assert_eq!(events.len(), 1, "{:?}", events);
match events.pop().unwrap().event.unwrap() {
// Then it outputs Initialized event.
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 1, "{:?}", es);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Initialized, "{:?}", es);
}
Event_oneof_event::Error(e) => panic!("{:?}", e),
Event_oneof_event::ResolvedTs(e) => panic!("{:?}", e),
Event_oneof_event::Admin(e) => panic!("{:?}", e),
}
event_feed_wrap.as_ref().replace(None);
suite.stop();
} | rust_cleaned_test_functions.jsonl/23562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2789
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
7628,
28857,
368,
341,
262,
1077,
5206,
16182,
284,
3393,
28000,
486,
931,
7,
16,
626,
262,
1077,
320,
74,
11,
348,
8,
284,
320,
65,
1,
792,
16,
3263,
983,
13251,
1507,
293,
63307,
3263... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_i16_segment() {
let dat = vec![1i16, 3, 10, 15, 23, 4, 45];
assert_write_check_read(dat, 8);
} | rust_cleaned_test_functions.jsonl/118842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5318,
16,
21,
28061,
368,
341,
262,
1077,
3258,
284,
7486,
20703,
16,
72,
16,
21,
11,
220,
18,
11,
220,
16,
15,
11,
220,
16,
20,
11,
220,
17,
18,
11,
220,
19,
11,
220,
19,
20,
935,
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 |
#[test]
fn test_unit_parser_dimensionless_unit_scale() {
let unit = parse_unit().parse(b"percent, %; ; 0.01").expect("Unit");
assert!(unit.ids.contains(&"percent".to_string()));
assert!(unit.ids.contains(&"%".to_string()));
assert_eq!(unit.scale, 0.01);
assert_eq!(unit.offset, 0.0);
assert!(unit.dimensions.is_none());
let unit = parse_unit()
.parse(b"degrees_phase, degPh; ; 0.017453292519943")
.expect("Unit");
assert!(unit.ids.contains(&"degrees_phase".to_string()));
assert!(unit.ids.contains(&"degPh".to_string()));
assert_eq!(unit.scale, 0.017453292519943);
} | rust_cleaned_test_functions.jsonl/43788 | {
"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,
14832,
18517,
49619,
1717,
14832,
16727,
368,
341,
286,
1077,
4982,
284,
4715,
14832,
1005,
6400,
1883,
1,
24422,
11,
1018,
26,
2587,
220,
15,
13,
15,
16,
1827,
17119,
445,
4562,
3071,
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_mv_backup_simple() {
let (at, mut ucmd) = at_and_ucmd!();
let file_a = "test_mv_backup_numbering_file_a";
let file_b = "test_mv_backup_numbering_file_b";
at.touch(file_a);
at.touch(file_b);
ucmd.arg("--backup=simple")
.arg(file_a)
.arg(file_b)
.succeeds()
.no_stderr();
assert!(!at.file_exists(file_a));
assert!(at.file_exists(file_b));
assert!(at.file_exists(&format!("{}~", file_b)));
} | rust_cleaned_test_functions.jsonl/41619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
44710,
30015,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
4306,
284,
330,
1944,
73187,
44710,
5500,
287,
2458,
4306,
876,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_selector_from_non_ascii_name() {
let func_name = "🦀";
match get_selector_from_name(func_name) {
Err(_) => {}
_ => panic!("Should throw error on non-ASCII name"),
};
} | rust_cleaned_test_functions.jsonl/33913 | {
"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,
3062,
28890,
5673,
21637,
50238,
1269,
368,
341,
286,
1077,
2915,
1269,
284,
330,
147579,
3302,
286,
2432,
633,
28890,
5673,
1269,
18552,
1269,
8,
341,
310,
15495,
48139,
589,
5613,
310,
716,
589,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_backward65536() {
assert_decompressed_input_matches_output(include_bytes!("../../testdata/backward65536.compressed"),
include_bytes!("../../testdata/backward65536"),
65536,
65536);
} | rust_cleaned_test_functions.jsonl/26428 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70477,
21,
20,
20,
18,
21,
368,
341,
220,
2060,
2259,
45703,
5898,
38344,
7645,
77863,
12524,
17223,
2748,
92425,
59948,
1606,
21,
20,
20,
18,
21,
905,
14318,
4461,
14265,
2924,
12524,
17223,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builder_tag() {
let s = SchemaBuilder::new()
.tag("the_tag")
.non_null_tag("the_non_null_tag")
.build()
.unwrap();
let (influxdb_column_type, field) = s.field(0);
assert_eq!(field.name(), "the_tag");
assert_eq!(
field.data_type(),
&ArrowDataType::Dictionary(
Box::new(ArrowDataType::Int32),
Box::new(ArrowDataType::Utf8)
)
);
assert!(field.is_nullable());
assert_eq!(influxdb_column_type, Some(Tag));
let (influxdb_column_type, field) = s.field(1);
assert_eq!(field.name(), "the_non_null_tag");
assert_eq!(
field.data_type(),
&ArrowDataType::Dictionary(
Box::new(ArrowDataType::Int32),
Box::new(ArrowDataType::Utf8)
)
);
assert!(!field.is_nullable());
assert_eq!(influxdb_column_type, Some(Tag));
assert_eq!(s.len(), 2);
} | rust_cleaned_test_functions.jsonl/12632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 588
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
9372,
368,
341,
286,
1077,
274,
284,
12539,
3297,
486,
931,
741,
310,
659,
4578,
445,
1782,
9372,
1138,
310,
659,
6280,
15162,
9372,
445,
1782,
21637,
15162,
9372,
1138,
310,
659,
5834,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_str_bidi() {
assert!(!is_str_bidi("abcdefghijklmnopaabcdefghijklmnop"));
assert!(!is_str_bidi("abcdefghijklmnop\u{03B1}abcdefghijklmnop"));
assert!(!is_str_bidi("abcdefghijklmnop\u{3041}abcdefghijklmnop"));
assert!(!is_str_bidi("abcdefghijklmnop\u{1F4A9}abcdefghijklmnop"));
assert!(!is_str_bidi("abcdefghijklmnop\u{FE00}abcdefghijklmnop"));
assert!(!is_str_bidi("abcdefghijklmnop\u{202C}abcdefghijklmnop"));
assert!(!is_str_bidi("abcdefghijklmnop\u{FEFF}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{0590}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{08FF}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{061C}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{FB50}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{FDFF}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{FE70}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{FEFE}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{200F}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{202B}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{202E}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{2067}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{10800}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{10FFF}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{1E800}abcdefghijklmnop"));
assert!(is_str_bidi("abcdefghijklmnop\u{1EFFF}abcdefghijklmnop"));
} | rust_cleaned_test_functions.jsonl/27322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 916
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
2895,
880,
12278,
368,
341,
286,
2060,
0,
3471,
285,
2895,
880,
12278,
445,
63168,
21775,
39852,
65102,
4010,
286,
2060,
0,
3471,
285,
2895,
880,
12278,
445,
65102,
3770,
90,
15,
18,
33,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_explorer_blocks_loaded_info() {
let (mut testkit, api) = init_testkit();
testkit.create_blocks_until(Height(6));
let BlocksRange { blocks, .. } = api
.public(ApiKind::Explorer)
.get("v1/blocks?count=4")
.unwrap();
assert!(blocks
.iter()
.all(|info| info.time.is_none() && info.precommits.is_none()));
let BlocksRange { blocks, .. } = api
.public(ApiKind::Explorer)
.get("v1/blocks?count=4&add_blocks_time=true")
.unwrap();
assert!(blocks
.iter()
.all(|info| info.time.is_some() && info.precommits.is_none()));
let BlocksRange { blocks, .. } = api
.public(ApiKind::Explorer)
.get("v1/blocks?count=4&add_precommits=true")
.unwrap();
assert!(blocks
.iter()
.all(|info| info.time.is_none() && info.precommits.is_some()));
} | rust_cleaned_test_functions.jsonl/55300 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 428
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
79825,
25201,
49205,
3109,
368,
341,
262,
1077,
320,
6984,
1273,
8226,
11,
6330,
8,
284,
2930,
4452,
8226,
543,
262,
1273,
8226,
2520,
25201,
44352,
7,
3640,
7,
21,
3237,
262,
1077,
45678,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_basic() {
let p: NoiseParams = "Noise_XX_25519_AESGCM_SHA256".parse().unwrap();
assert!(p.handshake.modifiers.list.is_empty());
} | rust_cleaned_test_functions.jsonl/14546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
368,
341,
286,
1077,
281,
25,
50523,
4870,
284,
330,
61819,
62,
6148,
62,
17,
20,
20,
16,
24,
69381,
38,
9985,
38096,
17,
20,
21,
3263,
6400,
1005,
15454,
543,
286,
2060,
10297,
79,
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 |
#[test]
fn test_pitch_bend_midi_conversion() {
let event = NoteEvent::MidiPitchBend {
timing: TIMING,
channel: 1,
value: 0.6929134,
};
assert_eq!(
NoteEvent::from_midi(TIMING, event.as_midi().unwrap()).unwrap(),
event
);
} | rust_cleaned_test_functions.jsonl/115675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51959,
880,
408,
717,
12278,
64132,
368,
341,
286,
1077,
1538,
284,
7036,
1556,
486,
44,
12278,
47071,
33,
408,
341,
310,
18405,
25,
17742,
1718,
345,
310,
5496,
25,
220,
16,
345,
310,
897,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator_step_by_nth_try_fold() {
let mut it = (0..).step_by(10);
assert_eq!(it.try_fold(0, i8::checked_add), None);
assert_eq!(it.next(), Some(60));
assert_eq!(it.try_fold(0, i8::checked_add), None);
assert_eq!(it.next(), Some(90));
let mut it = (100..).step_by(10);
assert_eq!(it.try_fold(50, i8::checked_add), None);
assert_eq!(it.next(), Some(110));
let mut it = (100..=100).step_by(10);
assert_eq!(it.next(), Some(100));
assert_eq!(it.try_fold(0, i8::checked_add), Some(0));
} | rust_cleaned_test_functions.jsonl/70142 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
11946,
3710,
78342,
53283,
61187,
368,
341,
262,
1077,
5206,
432,
284,
320,
15,
496,
568,
9520,
3710,
7,
16,
15,
317,
262,
2060,
10714,
10297,
275,
48779,
61187,
7,
15,
11,
600,
23,
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_stft_build_assertion_2() {
_test_stft(10, 10, None, None, Some(11), PadMode::Truncate).unwrap();
} | rust_cleaned_test_functions.jsonl/104791 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 59
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
723,
20801,
16553,
290,
62,
17,
368,
341,
262,
716,
1944,
1261,
723,
7,
16,
15,
11,
220,
16,
15,
11,
2240,
11,
2240,
11,
4329,
7,
16,
16,
701,
25299,
3636,
486,
1282,
26900,
568,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_collision_when_ranked_query() {
assert!(default_rank_route_collisions(&["/a?a=b", "/a?c=d"]));
assert!(default_rank_route_collisions(&["/<foo>?a=b", "/<foo>?c=d&<d>"]));
} | rust_cleaned_test_functions.jsonl/26088 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70375,
47636,
20417,
291,
5738,
368,
341,
286,
2060,
10297,
2258,
20417,
28109,
43597,
6805,
2099,
1183,
14,
64,
98461,
22086,
497,
3521,
64,
30,
66,
25405,
74446,
286,
2060,
10297,
2258,
20417,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boot_from_virtio_pmem() {
let focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest = Guest::new(Box::new(focal));
let kernel_path = direct_kernel_boot_path();
let mut child = GuestCommand::new(&guest)
.args(&["--cpus", "boot=1"])
.args(&["--memory", "size=512M"])
.args(&["--kernel", kernel_path.to_str().unwrap()])
.args(&[
"--disk",
format!(
"path={}",
guest.disk_config.disk(DiskType::CloudInit).unwrap()
)
.as_str(),
])
.default_net()
.args(&[
"--pmem",
format!(
"file={},size={}",
guest.disk_config.disk(DiskType::OperatingSystem).unwrap(),
fs::metadata(&guest.disk_config.disk(DiskType::OperatingSystem).unwrap())
.unwrap()
.len()
)
.as_str(),
])
.args(&[
"--cmdline",
DIRECT_KERNEL_BOOT_CMDLINE
.replace("vda1", "pmem0p1")
.as_str(),
])
.capture_output()
.spawn()
.unwrap();
let r = std::panic::catch_unwind(|| {
guest.wait_vm_boot(None).unwrap();
// Simple checks to validate the VM booted properly
assert_eq!(guest.get_cpu_count().unwrap_or_default(), 1);
assert!(guest.get_total_memory().unwrap_or_default() > 480_000);
});
let _ = child.kill();
let output = child.wait_with_output().unwrap();
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/26145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1052
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52062,
5673,
2273,
2106,
815,
620,
10536,
368,
341,
286,
1077,
41099,
284,
34960,
47583,
2648,
486,
931,
7,
3788,
49533,
19121,
4708,
2389,
3904,
1423,
286,
1077,
8640,
284,
26215,
486,
931,
67758... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sub() {
let z = Vec3::zero();
let v1 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
let v2 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
assert_eq!(v1 - v2, z);
let v1 = Vec3::new(3.0f64, 5.0f64, 7.0f64);
let v2 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
let v3 = Vec3::new(2.0f64, 3.0f64, 4.0f64);
assert_eq!(v1 - v2, v3);
} | rust_cleaned_test_functions.jsonl/120474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
368,
972,
286,
1077,
1147,
284,
11312,
18,
486,
14154,
1647,
286,
1077,
348,
16,
284,
11312,
18,
486,
931,
7,
16,
13,
15,
69,
21,
19,
11,
220,
17,
13,
15,
69,
21,
19,
11,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_literal_before_space() {
check(
r#"
struct Foo$0 {}
fn main() {
let f: Foo;
f = Foo {};
}
"#,
expect![[r#"
Foo Struct FileId(0) 0..13 7..10
FileId(0) 41..44
FileId(0) 54..57
"#]],
);
} | rust_cleaned_test_functions.jsonl/60631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
34100,
23708,
14663,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
33428,
3,
15,
5613,
262,
5168,
1887,
368,
341,
262,
1077,
282,
25,
33428,
280,
262,
282,
284,
33428,
9321,
532,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_13() {
assert_eq!(
parse_column_type(&mut Parser::new("varchar(20)")),
ColumnType::Varchar(StringAttr {
length: Some(20),
charset: None,
collation: None,
})
);
} | rust_cleaned_test_functions.jsonl/73842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
18,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
8744,
1819,
2099,
6984,
21102,
486,
931,
445,
32922,
7,
17,
15,
8,
30154,
310,
9332,
929,
486,
53,
1113,
277,
2242,
13371,
341,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ldrsb_reg() {
assert_eq!(
decode_16(0x5624),
Instruction::LDRSB_reg {
params: Reg3FullParams {
rt: Reg::R4,
rn: Reg::R4,
rm: Reg::R0,
shift_t: SRType::LSL,
shift_n: 0,
index: true,
add: true,
wback: false,
},
thumb32: false,
}
);
} | rust_cleaned_test_functions.jsonl/64783 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
50573,
5428,
65,
4920,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
16,
21,
7,
15,
87,
20,
21,
17,
19,
1326,
286,
29051,
486,
43,
7687,
16680,
4920,
341,
310,
3628,
25,
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_serde_de_unit_enum() -> Result<(), Box<EvalAltResult>> {
#[derive(Debug, PartialEq, Deserialize)]
enum MyEnum {
VariantFoo,
VariantBar,
}
let d = Dynamic::from("VariantFoo".to_string());
assert_eq!(MyEnum::VariantFoo, from_dynamic(&d)?);
let d = Dynamic::from("VariantBar".to_string());
assert_eq!(MyEnum::VariantBar, from_dynamic(&d)?);
Ok(())
} | rust_cleaned_test_functions.jsonl/97335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
2259,
14832,
31054,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
48440,
5563,
262,
7618,
3017,
10766,
341,
286,
39292,
40923... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tapscript_rtt() {
// Test x-only invalid under segwitc0 context
let ms = Segwitv0Script::from_str_insane(&format!(
"pk(2788ee41e76f4f3af603da5bc8fa22997bc0344bb0f95666ba6aaff0242baa99)"
));
assert_eq!(
ms.unwrap_err().to_string(),
"unexpected «Key hex decoding error: bad hex string length 64 (expected 66)»"
);
Tapscript::from_str_insane(&format!(
"pk(2788ee41e76f4f3af603da5bc8fa22997bc0344bb0f95666ba6aaff0242baa99)"
))
.unwrap();
// Now test that bitcoin::PublicKey works with Taproot context
Miniscript::<bitcoin::PublicKey, Tap>::from_str_insane(&format!(
"pk(022788ee41e76f4f3af603da5bc8fa22997bc0344bb0f95666ba6aaff0242baa99)"
))
.unwrap();
// uncompressed keys should not be allowed
Miniscript::<bitcoin::PublicKey, Tap>::from_str_insane(&format!(
"pk(04eed24a081bf1b1e49e3300df4bebe04208ac7e516b6f3ea8eb6e094584267c13483f89dcf194132e12238cc5a34b6b286fc7990d68ed1db86b69ebd826c63b29)"
))
.unwrap_err();
//---------------- test script <-> miniscript ---------------
// Test parsing from scripts: x-only fails decoding in segwitv0 ctx
Segwitv0Script::parse_insane(&hex_script(
"202788ee41e76f4f3af603da5bc8fa22997bc0344bb0f95666ba6aaff0242baa99ac",
))
.unwrap_err();
// x-only succeeds in tap ctx
Tapscript::parse_insane(&hex_script(
"202788ee41e76f4f3af603da5bc8fa22997bc0344bb0f95666ba6aaff0242baa99ac",
))
.unwrap();
// tapscript fails decoding with compressed
Tapscript::parse_insane(&hex_script(
"21022788ee41e76f4f3af603da5bc8fa22997bc0344bb0f95666ba6aaff0242baa99ac",
))
.unwrap_err();
// Segwitv0 succeeds decoding with tapscript.
Segwitv0Script::parse_insane(&hex_script(
"21022788ee41e76f4f3af603da5bc8fa22997bc0344bb0f95666ba6aaff0242baa99ac",
))
.unwrap();
// multi not allowed in tapscript
Tapscript::from_str_insane(&format!(
"multi(1,2788ee41e76f4f3af603da5bc8fa22997bc0344bb0f95666ba6aaff0242baa99)"
))
.unwrap_err();
// but allowed in segwit
Segwitv0Script::from_str_insane(&format!(
"multi(1,022788ee41e76f4f3af603da5bc8fa22997bc0344bb0f95666ba6aaff0242baa99)"
))
.unwrap();
} | rust_cleaned_test_functions.jsonl/129415 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
391,
2282,
1710,
5566,
368,
341,
286,
442,
3393,
856,
15382,
8318,
1212,
4810,
88519,
66,
15,
2266,
198,
286,
1077,
9829,
284,
17209,
88519,
85,
15,
5910,
486,
1499,
2895,
34386,
2145,
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_json_value() {
let json = serde_json::json! {{
"a": 25.0,
"b": "hello",
}};
let value: Value = json.clone().into();
let out: Json = value.unwrap();
assert_eq!(out, json);
} | rust_cleaned_test_functions.jsonl/12484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
3142,
368,
341,
286,
1077,
2951,
284,
61570,
9455,
486,
2236,
0,
80505,
310,
330,
64,
788,
220,
17,
20,
13,
15,
345,
310,
330,
65,
788,
330,
14990,
756,
286,
87037,
286,
1077,
897,
25,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remappings_override() {
figment::Jail::expect_with(|jail| {
jail.create_file(
"foundry.toml",
r#"
[default]
src = "some-source"
out = "some-out"
cache = true
"#,
)?;
let config = Config::load();
assert!(config.remappings.is_empty());
jail.create_file(
"remappings.txt",
r#"
ds-test/=lib/ds-test/
other/=lib/other/
"#,
)?;
let config = Config::load();
assert_eq!(
config.remappings,
vec![
Remapping::from_str("ds-test/=lib/ds-test/").unwrap().into(),
Remapping::from_str("other/=lib/other/").unwrap().into(),
],
);
jail.set_env("DAPP_REMAPPINGS", "ds-test/=lib/ds-test/src/\nenv-lib/=lib/env-lib/");
let config = Config::load();
// Remappings should now be:
assert_eq!(
config.remappings,
vec![
Remapping::from_str("ds-test/=lib/ds-test/src/").unwrap().into(),
Remapping::from_str("env-lib/=lib/env-lib/").unwrap().into(),
Remapping::from_str("other/=lib/other/").unwrap().into(),
],
);
// contains additional remapping to the source dir
assert_eq!(
config.get_all_remappings(),
vec![
Remapping::from_str("ds-test/=lib/ds-test/src/").unwrap(),
Remapping::from_str("env-lib/=lib/env-lib/").unwrap(),
Remapping::from_str("other/=lib/other/").unwrap(),
Remapping::from_str("some-source/=some-source").unwrap(),
],
);
Ok(())
});
} | rust_cleaned_test_functions.jsonl/42698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19194,
23036,
48576,
368,
341,
286,
4144,
478,
486,
41,
604,
486,
17119,
6615,
22428,
73,
604,
91,
341,
310,
17540,
2520,
2458,
1006,
394,
330,
15105,
884,
73494,
75,
756,
394,
435,
2,
698,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_push_zeros() {
let mut buffer = Buffer::allocate(5);
buffer.push(1);
buffer.push_zeros(2);
assert_eq!(&buffer[..], [1, 0, 0]);
} | rust_cleaned_test_functions.jsonl/87212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
83761,
368,
341,
286,
1077,
5206,
4147,
284,
10312,
486,
31191,
7,
20,
317,
286,
4147,
2552,
7,
16,
317,
286,
4147,
2552,
83761,
7,
17,
317,
286,
2060,
10714,
0,
2099,
7573,
95874,
1125... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_create_account() {
let new_owner = Pubkey::new(&[9; 32]);
let from = Pubkey::new_unique();
let to = Pubkey::new_unique();
let from_account = AccountSharedData::new(100, 0, &system_program::id());
let to_account = AccountSharedData::new(0, 0, &Pubkey::default());
let accounts = process_instruction(
&bincode::serialize(&SystemInstruction::CreateAccount {
lamports: 50,
space: 2,
owner: new_owner,
})
.unwrap(),
vec![(from, from_account), (to, to_account)],
vec![
AccountMeta {
pubkey: from,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: to,
is_signer: true,
is_writable: false,
},
],
Ok(()),
super::process_instruction,
);
assert_eq!(accounts[0].lamports(), 50);
assert_eq!(accounts[1].lamports(), 50);
assert_eq!(accounts[1].owner(), &new_owner);
assert_eq!(accounts[1].data(), &[0, 0]);
} | rust_cleaned_test_functions.jsonl/95868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 708
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
13500,
368,
341,
286,
1077,
501,
29027,
284,
22611,
792,
486,
931,
2099,
58,
24,
26,
220,
18,
17,
2558,
286,
1077,
504,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
311,
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_try_statement() {
expect_printed("try {} catch (err) {}", "try {} catch (err) {}");
expect_printed("try {} finally {}", "try {} finally {}");
expect_printed(
"try {} catch (err) {} finally {}",
"try {} catch (err) {} finally {}",
);
} | rust_cleaned_test_functions.jsonl/93440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
37404,
368,
341,
262,
1720,
10064,
291,
445,
1539,
4687,
2287,
320,
615,
8,
24689,
330,
1539,
4687,
2287,
320,
615,
8,
4687,
797,
262,
1720,
10064,
291,
445,
1539,
4687,
5499,
24689,
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_cb_called_on_error() {
let result = call_callback(Err(ErrorCode::CommonInvalidState)).unwrap();
assert_eq!(ErrorCode::CommonInvalidState, result.0);
assert_eq!(String::from(""), result.1);
} | rust_cleaned_test_functions.jsonl/12835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16450,
27859,
4470,
4096,
368,
341,
286,
1077,
1102,
284,
1618,
12519,
7,
7747,
7,
30748,
486,
10839,
7928,
1397,
4579,
15454,
543,
286,
2060,
10714,
10297,
30748,
486,
10839,
7928,
1397,
11,
1102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_oom() {
use goblin::container::{Container, Ctx};
use scroll::Pwrite;
fn test_oom(data: &mut [u8]) {
let mut modified_data = data.to_vec();
let mut elf = Elf::parse(&data).unwrap();
let endianness = elf.header.endianness().unwrap();
let ctx = Ctx::new(
if elf.is_64 {
Container::Big
} else {
Container::Little
},
endianness,
);
let original_e_phnum = elf.header.e_phnum;
let original_e_shnum = elf.header.e_shnum;
// Way too many program headers
elf.header.e_phnum = 1000;
modified_data
.pwrite_with(elf.header, 0, endianness)
.unwrap();
assert!(Elf::parse(&modified_data).is_err());
// Possible overflow of program headers
elf.header.e_phnum = std::u16::MAX;
modified_data
.pwrite_with(elf.header, 0, endianness)
.unwrap();
assert!(Elf::parse(&modified_data).is_err());
// Back to original
elf.header.e_phnum = original_e_phnum;
modified_data
.pwrite_with(elf.header, 0, endianness)
.unwrap();
assert!(Elf::parse(&modified_data).is_ok());
// Way too many section headers
elf.header.e_shnum = 1000;
modified_data
.pwrite_with(elf.header, 0, endianness)
.unwrap();
assert!(Elf::parse(&modified_data).is_err());
// Fallback to large empty section header's sh_size
elf.header.e_shnum = 0;
elf.section_headers[0].sh_size = std::u64::MAX;
modified_data
.pwrite_with(elf.header, 0, endianness)
.unwrap();
modified_data
.pwrite_with(
elf.section_headers[0].clone(),
elf.header.e_shoff as usize,
ctx,
)
.unwrap();
assert!(Elf::parse(&modified_data).is_err());
// Possible overflow of section headers
elf.header.e_shnum = std::u16::MAX;
modified_data
.pwrite_with(elf.header, 0, endianness)
.unwrap();
assert!(Elf::parse(&modified_data).is_err());
// Back to original
elf.header.e_shnum = original_e_shnum;
modified_data
.pwrite_with(elf.header, 0, endianness)
.unwrap();
assert!(Elf::parse(&modified_data).is_ok());
}
let aligned_data: &mut AlignedData<[u8]> =
&mut AlignedData(*include_bytes!("bins/elf/gnu_hash/hello32.so"));
test_oom(&mut aligned_data.0);
let aligned_data: &mut AlignedData<[u8]> =
&mut AlignedData(*include_bytes!("bins/elf/gnu_hash/hello.so"));
test_oom(&mut aligned_data.0);
} | rust_cleaned_test_functions.jsonl/58422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
4191,
368,
341,
262,
990,
342,
47061,
486,
3586,
22964,
4502,
11,
356,
3998,
2440,
262,
990,
9059,
486,
47,
4934,
401,
262,
5168,
1273,
62,
4191,
2592,
25,
609,
6984,
508,
84,
23,
2467,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_format_docs_handles_complex_code_block_attrs() {
let comment = "```rust,no_run\nlet z = 55;\n```";
assert_eq!(format_docs(comment), "```rust\nlet z = 55;\n```");
} | rust_cleaned_test_functions.jsonl/57086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
49692,
68017,
41522,
4136,
7113,
39578,
368,
341,
286,
1077,
3980,
284,
330,
73594,
35788,
84198,
14007,
1699,
1149,
1147,
284,
220,
20,
20,
17882,
77,
73594,
876,
286,
2060,
10714,
10297,
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 |
#[test]
fn test_mut_rev_iterator() {
let mut m = SmallIntMap::new();
assert!(m.insert(0, 1));
assert!(m.insert(1, 2));
assert!(m.insert(3, 5));
assert!(m.insert(6, 10));
assert!(m.insert(10, 11));
for (k, v) in m.mut_rev_iter() {
*v += k as int;
}
let mut it = m.iter();
assert_eq!(it.next().unwrap(), (0, &1));
assert_eq!(it.next().unwrap(), (1, &3));
assert_eq!(it.next().unwrap(), (3, &8));
assert_eq!(it.next().unwrap(), (6, &16));
assert_eq!(it.next().unwrap(), (10, &21));
assert!(it.next().is_none());
} | rust_cleaned_test_functions.jsonl/7542 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
38082,
13491,
368,
341,
286,
1077,
5206,
296,
284,
14994,
1072,
2227,
486,
931,
1428,
286,
2060,
10297,
76,
7030,
7,
15,
11,
220,
16,
1106,
286,
2060,
10297,
76,
7030,
7,
16,
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... | 2 |
#[test]
fn test_tsconfig_as_bytes() {
let mut tsconfig1 = TsConfig::new(json!({
"strict": true,
"target": "esnext",
}));
tsconfig1.merge(&json!({
"target": "es5",
"module": "amd",
}));
let mut tsconfig2 = TsConfig::new(json!({
"target": "esnext",
"strict": true,
}));
tsconfig2.merge(&json!({
"module": "amd",
"target": "es5",
}));
assert_eq!(tsconfig1.as_bytes(), tsconfig2.as_bytes());
} | rust_cleaned_test_functions.jsonl/107842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25023,
1676,
11898,
12524,
368,
341,
262,
1077,
5206,
10591,
1676,
16,
284,
25076,
2648,
486,
931,
9304,
0,
2262,
414,
330,
6627,
788,
830,
345,
414,
330,
5657,
788,
330,
288,
3600,
756,
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_display() {
assert_eq!(
FromHexError::InvalidHexCharacter { c: '\n', index: 5 }.to_string(),
"Invalid character '\\n' at position 5"
);
assert_eq!(FromHexError::OddLength.to_string(), "Odd number of digits");
assert_eq!(
FromHexError::InvalidStringLength.to_string(),
"Invalid string length"
);
} | rust_cleaned_test_functions.jsonl/21663 | {
"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,
14825,
368,
341,
286,
2060,
10714,
33673,
310,
5542,
20335,
1454,
486,
7928,
20335,
12404,
314,
272,
25,
5196,
77,
516,
1922,
25,
220,
20,
16908,
983,
3904,
3148,
310,
330,
7928,
3668,
28078,
77... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arg_matches_true() {
let argv = vec!["lsd", "--classify"];
let matches = app::build().get_matches_from_safe(argv).unwrap();
assert_eq!(
Some(Indicators(true)),
Indicators::from_arg_matches(&matches)
);
} | rust_cleaned_test_functions.jsonl/80245 | {
"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,
5673,
6057,
38344,
16082,
368,
341,
286,
1077,
10213,
284,
7486,
0,
1183,
4730,
67,
497,
14482,
94290,
6332,
286,
1077,
9071,
284,
906,
486,
5834,
1005,
455,
38344,
5673,
34067,
15329,
568,
15454,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_obj_array() {
let mut lin = LinearAllocator::new(100_000);
let mut sc = ScopeStack::new(&mut lin);
let mut count = 0;
let mut arr = sc.alloc_obj_array(6).unwrap();
for _ in 0..6 {
unsafe {
std::ptr::write(
arr.as_ptr(),
TestObj {
res: NonNull::new_unchecked((&mut count) as *mut _),
},
);
arr = NonNull::new_unchecked(arr.as_ptr().add(1));
}
}
assert_eq!(0, count, "Expected count to be untouched");
drop(sc);
assert_eq!(6, count);
} | rust_cleaned_test_functions.jsonl/107401 | {
"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,
7328,
3858,
368,
341,
286,
1077,
5206,
9805,
284,
28263,
42730,
486,
931,
7,
16,
15,
15,
62,
15,
15,
15,
317,
286,
1077,
5206,
1136,
284,
34920,
4336,
486,
931,
2099,
6984,
9805,
626,
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... | 2 |
#[test]
fn test_samples_from_key_ranges() {
let key_ranges = vec![];
assert_eq!(Samples::from(key_ranges).0.len(), 0);
let key_ranges = vec![build_key_range(b"a", b"b", false)];
assert_eq!(Samples::from(key_ranges).0.len(), 2);
let key_ranges = vec![
build_key_range(b"a", b"a", false),
build_key_range(b"b", b"c", false),
];
assert_eq!(Samples::from(key_ranges).0.len(), 3);
} | rust_cleaned_test_functions.jsonl/51347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18297,
5673,
3097,
58748,
368,
341,
286,
1077,
1376,
58748,
284,
7486,
0,
15078,
286,
2060,
10714,
10297,
39571,
486,
1499,
4857,
58748,
568,
15,
19406,
1507,
220,
15,
626,
286,
1077,
1376,
58748,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uptime() {
use sysinfo::SystemExt;
let mut s = sysinfo::System::new();
s.refresh_all();
assert!(s.get_uptime() != 0);
} | rust_cleaned_test_functions.jsonl/41750 | {
"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,
7300,
28941,
368,
341,
262,
990,
5708,
2733,
486,
2320,
6756,
401,
262,
1077,
5206,
274,
284,
5708,
2733,
486,
2320,
486,
931,
543,
262,
274,
26031,
5705,
543,
262,
2060,
10297,
82,
670,
7300,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_filter_by_file_size() {
let dir = PathBuf::from(TEST_DIR);
let filter = Filter::new().with_min_size(Size::Byte(100));
let files: Vec<DirEntry> = create_walker(&Config::default(), &dir)
.into_iter()
.filter_map(|e| e.ok())
.filter(|e| filter.accept(&e))
.collect();
let result: (u64, u64) = summarize(files);
assert_eq!(1, result.0);
assert_eq!(100, result.1);
} | rust_cleaned_test_functions.jsonl/54486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
3710,
2458,
2368,
368,
341,
286,
1077,
5419,
284,
7933,
15064,
486,
1499,
50320,
8291,
317,
286,
1077,
4051,
284,
12339,
486,
931,
1005,
4197,
7260,
2368,
81779,
486,
7153,
7,
16,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sort_hash_intermediate() {
solana_logger::setup();
let mut stats = HashStats::default();
let key = Pubkey::new_unique();
let hash = Hash::new_unique();
let val = CalculateHashIntermediate::new(1, hash, 1, 1, key);
let hash2 = Hash::new_unique();
let val2 = CalculateHashIntermediate::new(0, hash2, 4, 1, key);
let val3 = CalculateHashIntermediate::new(3, hash2, 4, 1, key);
let val4 = CalculateHashIntermediate::new(4, hash2, 4, 1, key);
let src = vec![vec![val2.clone()], vec![val.clone()]];
let result = AccountsHash::sort_hash_intermediate(src.clone(), &mut stats);
assert_eq!(result, src);
let src = vec![
vec![val2.clone(), val.clone()],
vec![val3.clone(), val4.clone()],
];
let sorted = vec![vec![val, val2], vec![val4, val3]];
let result = AccountsHash::sort_hash_intermediate(src, &mut stats);
assert_eq!(result, sorted);
let src = vec![vec![]];
let result = AccountsHash::sort_hash_intermediate(src.clone(), &mut stats);
assert_eq!(result, src);
let src = vec![];
let result = AccountsHash::sort_hash_intermediate(src.clone(), &mut stats);
assert_eq!(result, src);
} | rust_cleaned_test_functions.jsonl/17803 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 597
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
8950,
15318,
14636,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
5206,
10472,
284,
6531,
16635,
486,
2258,
543,
286,
1077,
1376,
284,
22611,
792,
486,
931,
21218,
543,
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_fmt() {
use header::Headers;
let mut cookie = Cookie::new("foo".to_owned(), "bar".to_owned());
cookie.httponly = true;
cookie.path = Some("/p".to_owned());
let cookies = SetCookie(vec![cookie, Cookie::new("baz".to_owned(), "quux".to_owned())]);
let mut headers = Headers::new();
headers.set(cookies);
assert_eq!(
&headers.to_string()[..],
"Set-Cookie: foo=bar; HttpOnly; Path=/p\r\nSet-Cookie: baz=quux; Path=/\r\n");
} | rust_cleaned_test_functions.jsonl/69237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38128,
368,
341,
262,
990,
4247,
486,
10574,
401,
262,
1077,
5206,
12544,
284,
24356,
486,
931,
445,
7975,
3263,
983,
51973,
1507,
330,
2257,
3263,
983,
51973,
1423,
262,
12544,
21081,
83,
618,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_now() -> Result<(), Error> {
let now_expression = parse_expression("Now()")?;
let values = HashMap::new();
let fetcher = Fetcher::TrialData(TrialDataFetcher::new(&values));
let files = HashMap::new();
let state = MetricState::new(&files, fetcher, Some(2000));
let time = state.evaluate_expression(&now_expression);
let no_time = state.evaluate_expression(&parse_expression("Now(5)")?);
assert_eq!(time, i(2000));
assert_missing!(no_time, "Now() requires no operands.");
Ok(())
} | rust_cleaned_test_functions.jsonl/68259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20813,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
1431,
28068,
284,
4715,
28068,
445,
7039,
368,
899,
37445,
286,
1077,
2750,
284,
10528,
486,
931,
543,
286,
1077,
7807,
261,
284,
22104,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multi_string_info_tag() {
let mut reader = Reader::from_path("test/test-info-multi-string.vcf").unwrap();
let mut rec = reader.empty_record();
let _ = reader.read(&mut rec);
assert_eq!(
rec.info_shared_buffer(b"ANN", Buffer::new())
.string()
.unwrap()
.unwrap()
.len(),
14
);
} | rust_cleaned_test_functions.jsonl/8780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
3904,
3109,
9372,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
1499,
2638,
445,
1944,
12697,
12505,
95669,
30881,
3133,
9792,
1827,
15454,
543,
286,
1077,
5206,
1395,
284,
6604,
9178,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_happened_before() {
let mut s1 = SimulatedLedgerState::new();
let mut s2 = SimulatedLedgerState::new();
assert!(!s1.happened_just_before(&s2));
s1.execute(
Command {
proposer: Author(0),
index: 0,
},
NodeTime(1),
);
assert!(!s1.happened_just_before(&s2));
assert!(s2.happened_just_before(&s1));
s1.execute(
Command {
proposer: Author(1),
index: 0,
},
NodeTime(1),
);
s2.execute(
Command {
proposer: Author(1),
index: 0,
},
NodeTime(1),
);
assert!(!s2.happened_just_before(&s1));
} | rust_cleaned_test_functions.jsonl/95862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
676,
6758,
23708,
368,
341,
262,
1077,
5206,
274,
16,
284,
4467,
7757,
60850,
1389,
1397,
486,
931,
543,
262,
1077,
5206,
274,
17,
284,
4467,
7757,
60850,
1389,
1397,
486,
931,
543,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_color() {
assert_eq!(set_color("PENDING"), "bFbl");
assert_eq!(set_color("IN PROGRESS"), "bFyl");
assert_eq!(set_color("OFFER RECEIVED"), "bFml");
assert_eq!(set_color("HIRED"), "bFgl");
assert_eq!(set_color("REJECTED"), "bFrl");
assert_eq!(set_color("should return empty string"), "");
} | rust_cleaned_test_functions.jsonl/92016 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
6714,
368,
341,
286,
2060,
10714,
10297,
746,
6714,
445,
47,
30879,
3975,
330,
65,
37,
2024,
797,
286,
2060,
10714,
10297,
746,
6714,
445,
687,
5308,
36185,
3975,
330,
65,
37,
3923,
797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_drop_create() {
init!("true");
let handle = create_connection("test_create_drop_create").unwrap();
let did1 = get_pw_did(handle).unwrap();
assert!(release(handle).is_ok());
let handle2 = create_connection("test_create_drop_create").unwrap();
assert_ne!(handle, handle2);
let did2 = get_pw_did(handle2).unwrap();
assert_eq!(did1, did2);
assert!(release(handle2).is_ok());
} | rust_cleaned_test_functions.jsonl/34216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
29584,
8657,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
3705,
284,
1855,
15866,
445,
1944,
8657,
29584,
8657,
1827,
15454,
543,
286,
1077,
1521,
16,
284,
633,
60181,
814,
307,
26405,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_collation() {
let mut ctx = EvalContext::default();
let cases = vec![
(Collation::Binary, true, vec!["B", "a"], "a"),
(Collation::Utf8Mb4Bin, true, vec!["B", "a"], "a"),
(Collation::Utf8Mb4GeneralCi, true, vec!["B", "a"], "B"),
(Collation::Utf8Mb4BinNoPadding, true, vec!["B", "a"], "a"),
(Collation::Binary, false, vec!["B", "a"], "B"),
(Collation::Utf8Mb4Bin, false, vec!["B", "a"], "B"),
(Collation::Utf8Mb4GeneralCi, false, vec!["B", "a"], "a"),
(Collation::Utf8Mb4BinNoPadding, false, vec!["B", "a"], "B"),
];
for (coll, is_max, args, expected) in cases {
let function = match_template_collator! {
TT, match coll {
Collation::TT => {
if is_max {
Box::new(AggFnExtremumForBytes::<TT, Max>::new()) as Box<dyn AggrFunction>
} else {
Box::new(AggFnExtremumForBytes::<TT, Min>::new()) as Box<dyn AggrFunction>
}
}
}
};
let mut state = function.create_state();
let mut result = [VectorValue::with_capacity(0, EvalType::Bytes)];
state.push_result(&mut ctx, &mut result).unwrap();
assert_eq!(result[0].as_bytes_slice(), &[None]);
for arg in args {
state
.update(&mut ctx, &Some(String::from(arg).into_bytes()))
.unwrap();
}
result[0].clear();
state.push_result(&mut ctx, &mut result).unwrap();
assert_eq!(
result[0].as_bytes_slice(),
[Some(String::from(expected).into_bytes())]
);
}
} | rust_cleaned_test_functions.jsonl/9278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1073
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43597,
367,
368,
341,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
2258,
543,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
15265,
367,
486,
21338,
11,
830,
11,
7486,
0,
1183,
33,
497,
330,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_parse_number() {
assert_eq!(parse_number(FileSpan::new(Rc::new(String::from("3.14")), Rc::new(String::from("input")))).unwrap().1.value, 3.14);
assert_eq!(parse_number(FileSpan::new(Rc::new(String::from("-3.14")), Rc::new(String::from("input")))).unwrap().1.value, -3.14);
assert_eq!(parse_number(FileSpan::new(Rc::new(String::from("3e10")), Rc::new(String::from("input")))).unwrap().1.value, 3e10);
assert_eq!(parse_number(FileSpan::new(Rc::new(String::from("3E10")), Rc::new(String::from("input")))).unwrap().1.value, 3e10);
assert_eq!(parse_number(FileSpan::new(Rc::new(String::from("3e-10")), Rc::new(String::from("input")))).unwrap().1.value, 3e-10);
assert_eq!(parse_number(FileSpan::new(Rc::new(String::from("0.5")), Rc::new(String::from("input")))).unwrap().1.value,0.5);
assert_eq!(parse_number(FileSpan::new(Rc::new(String::from(".5")), Rc::new(String::from("input")))).unwrap().1.value, 0.5);
} | rust_cleaned_test_functions.jsonl/68343 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5500,
368,
341,
262,
2060,
10714,
10297,
6400,
5500,
19821,
12485,
486,
931,
2785,
66,
486,
931,
2242,
486,
1499,
445,
18,
13,
16,
19,
35674,
81463,
486,
931,
2242,
486,
1499,
445,
1355,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seek() {
let ps = ParseStream {
content: "Hello".to_string(),
cursor: 1,
};
let index = ps.seek("lo").unwrap();
assert_eq!(ps.cursor, 1);
assert_eq!(index, 3);
} | rust_cleaned_test_functions.jsonl/41155 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
368,
341,
286,
1077,
4726,
284,
14775,
3027,
341,
310,
2213,
25,
330,
9707,
3263,
983,
3904,
3148,
310,
8128,
25,
220,
16,
345,
286,
3634,
286,
1077,
1922,
284,
4726,
38179,
445,
385,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_time_monitor() {
let jumped = Arc::new(AtomicBool::new(false));
let triggered = AtomicBool::new(false);
let now = move || {
if !triggered.load(Ordering::SeqCst) {
triggered.store(true, Ordering::SeqCst);
SystemTime::now()
} else {
SystemTime::now().sub(Duration::from_secs(2))
}
};
let jumped2 = Arc::clone(&jumped);
let on_jumped = move || {
jumped2.store(true, Ordering::SeqCst);
};
let _m = Monitor::new(on_jumped, now);
thread::sleep(Duration::from_secs(1));
assert_eq!(jumped.load(Ordering::SeqCst), true);
} | rust_cleaned_test_functions.jsonl/21941 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
40112,
368,
341,
286,
1077,
26005,
284,
19689,
486,
931,
7,
65857,
11233,
486,
931,
3576,
1106,
286,
1077,
22119,
284,
30316,
11233,
486,
931,
3576,
317,
286,
1077,
1431,
284,
3271,
1369,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tokenize_keywords() {
let input = "if else true false return";
let mut tokens = Lexer::new(input);
let expected = vec![
Token::If,
Token::Else,
Token::Boolean(true),
Token::Boolean(false),
Token::Return,
Token::EOF,
];
for token_expected in expected.iter() {
let token = tokens.next_token();
assert_eq!(&token, token_expected);
}
} | rust_cleaned_test_functions.jsonl/80425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86508,
51354,
368,
341,
286,
1077,
1946,
284,
330,
333,
770,
830,
895,
470,
876,
286,
1077,
5206,
11211,
284,
85082,
486,
931,
5384,
626,
286,
1077,
3601,
284,
7486,
90515,
310,
9660,
486,
2679,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_promise_str() {
use super::ToPromiseString;
assert_eq!(vec![].to_promise_string(), "");
assert_eq!(vec![Promise::Dns].to_promise_string(), "dns");
assert_eq!(
vec![Promise::Stdio, Promise::ProtExec].to_promise_string(),
"stdio prot_exec"
);
} | rust_cleaned_test_functions.jsonl/131804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
5273,
2895,
368,
341,
286,
990,
2256,
486,
1249,
21041,
703,
401,
286,
2060,
10714,
10297,
4083,
20703,
936,
983,
620,
5273,
3904,
1507,
14498,
286,
2060,
10714,
10297,
4083,
20703,
21041,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_put_and_get() {
let mut cache: LruCache<int, int> = LruCache::new(2);
cache.put(1, 10);
cache.put(2, 20);
assert_opt_eq(cache.get(&1), 10);
assert_opt_eq(cache.get(&2), 20);
assert_eq!(cache.len(), 2);
} | rust_cleaned_test_functions.jsonl/21879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
8378,
3062,
368,
341,
286,
1077,
5206,
6500,
25,
444,
2672,
8233,
4159,
11,
526,
29,
284,
444,
2672,
8233,
486,
931,
7,
17,
317,
286,
6500,
3597,
7,
16,
11,
220,
16,
15,
317,
286,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_false() {
let gil = Python::acquire_gil();
let py = gil.python();
assert!(!PyBool::new(py, false).is_true());
let t: &PyObjectRef = PyBool::new(py, false).into();
assert_eq!(false, t.extract().unwrap());
assert!(false.to_object(py) == PyBool::new(py, false).into());
} | rust_cleaned_test_functions.jsonl/112699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36015,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
2060,
0,
3471,
13828,
11233,
486,
931,
46827,
11,
895,
568,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_digraph_depth_first_search_order() {
let mut g = Digraph::new(7);
g.add_edge(0, 2);
g.add_edge(0, 5);
g.add_edge(0, 1);
g.add_edge(6, 0);
g.add_edge(5, 2);
g.add_edge(3, 2);
g.add_edge(3, 5);
g.add_edge(1, 4);
g.add_edge(3, 4);
g.add_edge(3, 6);
g.add_edge(6, 4);
let dfo: Vec<usize> = g.reverse_dfs_postorder().collect();
assert_eq!(vec![3, 6, 0, 5, 2, 1, 4], dfo);
} | rust_cleaned_test_functions.jsonl/66719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
53867,
19061,
12978,
10716,
7869,
368,
341,
262,
1077,
5206,
342,
284,
37969,
1935,
486,
931,
7,
22,
317,
262,
342,
1364,
17932,
7,
15,
11,
220,
17,
317,
262,
342,
1364,
17932,
7,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_affine3_serde() {
use crate::{Quat, Vec3};
let a = Affine3A::from_scale_rotation_translation(
Vec3::new(1.0, 2.0, 3.0),
Quat::IDENTITY,
Vec3::new(4.0, 5.0, 6.0),
);
let serialized = serde_json::to_string(&a).unwrap();
assert_eq!(
serialized,
"[1.0,0.0,0.0,0.0,2.0,0.0,0.0,0.0,3.0,4.0,5.0,6.0]"
);
let deserialized = serde_json::from_str(&serialized).unwrap();
assert_eq!(a, deserialized);
let deserialized = serde_json::from_str::<Affine3A>("[]");
assert!(deserialized.is_err());
let deserialized = serde_json::from_str::<Affine3A>("[1.0]");
assert!(deserialized.is_err());
let deserialized = serde_json::from_str::<Affine3A>("[1.0,2.0]");
assert!(deserialized.is_err());
let deserialized = serde_json::from_str::<Affine3A>("[1.0,2.0,3.0]");
assert!(deserialized.is_err());
let deserialized = serde_json::from_str::<Affine3A>("[1.0,2.0,3.0,4.0,5.0]");
assert!(deserialized.is_err());
let deserialized =
serde_json::from_str::<Affine3A>("[[1.0,2.0,3.0],[4.0,5.0,6.0],[7.0,8.0,9.0]]");
assert!(deserialized.is_err());
let deserialized = serde_json::from_str::<Affine3A>(
"[[1.0,2.0,3.0,4.0],[5.0,6.0,7.0,8.0],[9.0,10.0,11.0,12.0][13.0,14.0,15.0,16.0]]",
);
assert!(deserialized.is_err());
} | rust_cleaned_test_functions.jsonl/23875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 853
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48914,
482,
18,
75861,
450,
368,
341,
286,
990,
17717,
22964,
2183,
266,
11,
11312,
18,
2315,
286,
1077,
264,
284,
9748,
482,
18,
32,
486,
1499,
16727,
44813,
49273,
1006,
310,
11312,
18,
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_line_width() {
use crate::math::{point, Point};
use crate::geom::euclid::approxeq::ApproxEq;
let mut builder = crate::path::Path::builder();
builder.begin(point(0.0, 1.0));
builder.line_to(point(2.0, 1.0));
builder.end(false);
let path = builder.build();
let options = StrokeOptions::DEFAULT.with_line_width(2.0);
let mut geometry: VertexBuffers<Point, u16> = VertexBuffers::new();
StrokeTessellator::new()
.tessellate(
path.iter(),
&options,
&mut crate::geometry_builder::simple_builder(&mut geometry),
)
.unwrap();
for p in &geometry.vertices {
assert!(
p.approx_eq(&point(0.0, 0.0))
|| p.approx_eq(&point(0.0, 2.0))
|| p.approx_eq(&point(2.0, 0.0))
|| p.approx_eq(&point(2.0, 2.0))
);
}
} | rust_cleaned_test_functions.jsonl/83684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 458
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6528,
7927,
368,
341,
262,
990,
17717,
486,
10374,
22964,
2768,
11,
5126,
2440,
262,
990,
17717,
486,
41916,
486,
20128,
75044,
486,
15707,
8371,
80,
486,
28588,
12606,
80,
280,
262,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_pretty_print_var() {
assert_eq!(format!("{:?}", Variable {
id: 1,
value: &[],
}), "var_1");
assert_eq!(format!("{:?}", Variable {
id: 2,
value: &[9],
}), "var_2=[9]");
assert_eq!(format!("{:?}", Variable {
id: 2,
value: &[9, 0],
}), "var_2=[9]");
assert_eq!(format!("{:?}", Variable {
id: 2,
value: &[9, 8],
}), "var_2=[9,8]");
assert_eq!(format!("{:?}", Variable {
id: 3,
value: &[9, 8, 7, 6],
}), "var_3=[9,8,7,6]");
assert_eq!(format!("{:?}", Variable {
id: 3,
value: &[9, 8, 0, 6],
}), "var_3=[9,8,0,6]");
assert_eq!(format!("{:?}", Variable {
id: 4,
value: &[9, 8, 0, 6, 0, 0],
}), "var_4=[9,8,0,6]");
} | rust_cleaned_test_functions.jsonl/13349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
21322,
10064,
4612,
368,
341,
262,
2060,
10714,
10297,
2243,
88928,
25,
52652,
12407,
341,
286,
877,
25,
220,
16,
345,
286,
897,
25,
44590,
1259,
262,
31706,
330,
947,
62,
16,
797,
262,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_show_all_prices() -> Result<()> {
let sql = SqlBuilder::select_from("books")
.distinct()
.field("price")
.sql()?;
assert_eq!(&sql, "SELECT DISTINCT price FROM books;");
Ok(())
} | rust_cleaned_test_functions.jsonl/12587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15267,
5705,
65688,
368,
1464,
5714,
71698,
341,
286,
1077,
5704,
284,
7224,
3297,
486,
1742,
5673,
445,
12110,
1138,
310,
659,
53021,
741,
310,
659,
2566,
445,
6555,
1138,
310,
659,
3544,
368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_validate_tikv_config() {
let mut cfg = TiKvConfig::default();
let default_region_split_check_diff = cfg.raft_store.region_split_check_diff.0;
cfg.raft_store.region_split_check_diff.0 += 1;
assert!(cfg.validate().is_ok());
assert_eq!(
cfg.raft_store.region_split_check_diff.0,
default_region_split_check_diff + 1
);
// Test validating memory_usage_limit when it's greater than max.
cfg.memory_usage_limit.0 = Some(ReadableSize(SysQuota::memory_limit_in_bytes() * 2));
assert!(cfg.validate().is_err());
// Test memory_usage_limit is based on block cache size if it's not configured.
cfg.memory_usage_limit = OptionReadableSize(None);
cfg.storage.block_cache.capacity.0 = Some(ReadableSize(3 * GIB));
assert!(cfg.validate().is_ok());
assert_eq!(cfg.memory_usage_limit.0.unwrap(), ReadableSize(5 * GIB));
// Test memory_usage_limit will fallback to system memory capacity with huge block cache.
cfg.memory_usage_limit = OptionReadableSize(None);
let system = SysQuota::memory_limit_in_bytes();
cfg.storage.block_cache.capacity.0 = Some(ReadableSize(system * 3 / 4));
assert!(cfg.validate().is_ok());
assert_eq!(cfg.memory_usage_limit.0.unwrap(), ReadableSize(system));
} | rust_cleaned_test_functions.jsonl/31111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 588
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
528,
1579,
85,
5332,
368,
341,
286,
1077,
5206,
13286,
284,
22325,
42,
85,
2648,
486,
2258,
543,
286,
1077,
1638,
20627,
17052,
7200,
15850,
284,
13286,
13,
2944,
14809,
42976,
17052,
7200,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_duration_sub() {
let mut ts = Timestamp::new(333, TimeBase::new(1, 90_000));
ts -= Duration::from_millis(50);
assert_eq!(ts.timestamp, -4167);
} | rust_cleaned_test_functions.jsonl/119672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25454,
5228,
368,
341,
286,
1077,
5206,
10591,
284,
32758,
486,
931,
7,
18,
18,
18,
11,
4120,
3978,
486,
931,
7,
16,
11,
220,
24,
15,
62,
15,
15,
15,
3237,
286,
10591,
5982,
21045,
486,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uuid_win() {
assert_eq!(
ProguardMapping::new(&MAPPING_WIN[..]).uuid(),
"71d468f2-0dc4-5017-9f12-1a81081913ef".parse().unwrap()
);
} | rust_cleaned_test_functions.jsonl/73315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25540,
25672,
368,
341,
262,
2060,
10714,
33673,
286,
1298,
26098,
6807,
486,
931,
2099,
44,
55163,
34377,
95874,
10697,
17128,
3148,
286,
330,
22,
16,
67,
19,
21,
23,
69,
17,
12,
15,
7628,
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_null_to_none() {
assert_eq!(
serde_json::from_str::<Test>(r#"{ "test": null }"#).unwrap(),
Test { test: None }
);
} | rust_cleaned_test_functions.jsonl/134567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
2346,
31488,
368,
341,
286,
2060,
10714,
33673,
310,
61570,
9455,
486,
1499,
2895,
27638,
2271,
2235,
81,
2,
14129,
330,
1944,
788,
845,
335,
57676,
568,
15454,
3148,
310,
3393,
314,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_token_map() {
let expanded = parse_macro(
r#"
macro_rules! foobar {
($e:ident) => { fn $e() {} }
}
"#,
)
.expand_tt("foobar!(baz);");
let (node, token_map) = token_tree_to_syntax_node(&expanded, FragmentKind::Items).unwrap();
let content = node.syntax_node().to_string();
let get_text = |id, kind| -> String {
content[token_map.range_by_token(id).unwrap().by_kind(kind).unwrap()].to_string()
};
assert_eq!(expanded.token_trees.len(), 4);
// 012345 67 8 9 T12 3
assert_eq!(get_text(tt::TokenId(9), IDENT), "fn");
assert_eq!(get_text(tt::TokenId(12), T!['(']), "(");
assert_eq!(get_text(tt::TokenId(13), T!['{']), "{");
} | rust_cleaned_test_functions.jsonl/28702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6458,
5376,
368,
341,
262,
1077,
17183,
284,
4715,
58810,
1006,
286,
435,
2,
698,
32606,
21407,
0,
11756,
31393,
341,
262,
1711,
68,
25,
1713,
8,
589,
314,
5168,
400,
68,
368,
4687,
456,
532,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display() {
let raw = r#"{{if .}}2000{{else}} 3000 {{end}}"#;
let mut ts = parse(String::default(), String::from(raw), HashSet::default()).unwrap();
let tree = ts.get_mut("").unwrap();
if let Some(ref root) = tree.root {
assert_eq!(raw, format!("{}", root))
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/8629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
368,
341,
286,
1077,
7112,
284,
435,
55543,
2979,
333,
659,
3417,
17,
15,
15,
15,
2979,
1503,
3417,
220,
18,
15,
15,
15,
5867,
408,
23386,
2,
280,
286,
1077,
5206,
10591,
284,
4715,
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_ensure_parachain_running_or_error_liquidated_succeeds() {
run_test(|| {
ext::security::ensure_parachain_status_running::<Test>
.mock_safe(|| MockResult::Return(Ok(())));
assert_ok!(Redeem::ensure_parachain_running_or_error_liquidated());
ext::security::ensure_parachain_status_has_only_specific_errors::<Test>
.mock_safe(|_| MockResult::Return(Ok(())));
assert_ok!(Redeem::ensure_parachain_running_or_error_liquidated());
})
} | rust_cleaned_test_functions.jsonl/26915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
27289,
22654,
610,
466,
37333,
8734,
4096,
62,
53637,
657,
643,
29264,
82,
368,
341,
262,
1598,
4452,
79453,
341,
286,
1303,
486,
17039,
486,
27289,
22654,
610,
466,
4773,
37333,
27638,
2271,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_program_bpf_sanity() {
solana_logger::setup();
let mut programs = Vec::new();
#[cfg(feature = "bpf_c")]
{
programs.extend_from_slice(&[
("alloc", true),
("bpf_to_bpf", true),
("float", true),
("multiple_static", true),
("noop", true),
("noop++", true),
("panic", false),
("relative_call", true),
("return_data", true),
("sanity", true),
("sanity++", true),
("secp256k1_recover", true),
("sha", true),
("struct_pass", true),
("struct_ret", true),
]);
}
#[cfg(feature = "bpf_rust")]
{
programs.extend_from_slice(&[
("solana_bpf_rust_128bit", true),
("solana_bpf_rust_alloc", true),
("solana_bpf_rust_custom_heap", true),
("solana_bpf_rust_dep_crate", true),
("solana_bpf_rust_external_spend", false),
("solana_bpf_rust_iter", true),
("solana_bpf_rust_many_args", true),
("solana_bpf_rust_membuiltins", true),
("solana_bpf_rust_noop", true),
("solana_bpf_rust_panic", false),
("solana_bpf_rust_param_passing", true),
("solana_bpf_rust_rand", true),
("solana_bpf_rust_sanity", true),
("solana_bpf_rust_secp256k1_recover", true),
("solana_bpf_rust_sha", true),
]);
}
for program in programs.iter() {
println!("Test program: {:?}", program.0);
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
let mut bank = Bank::new_for_tests(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_program!();
bank.add_builtin(&name, &id, entrypoint);
let bank_client = BankClient::new(bank);
// Call user program
let program_id =
load_bpf_program(&bank_client, &bpf_loader::id(), &mint_keypair, program.0);
let account_metas = vec![
AccountMeta::new(mint_keypair.pubkey(), true),
AccountMeta::new(Keypair::new().pubkey(), false),
];
let instruction = Instruction::new_with_bytes(program_id, &[1], account_metas);
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
if program.1 {
assert!(result.is_ok());
} else {
assert!(result.is_err());
}
}
} | rust_cleaned_test_functions.jsonl/5736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
880,
15897,
643,
38270,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
5206,
7468,
284,
11312,
486,
931,
543,
262,
11506,
14072,
27062,
284,
330,
65,
15897,
666,
5422,
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... | 3 |
#[test]
fn test_is_locked_out_root_slot_sibling_fail() {
let mut tower = Tower::new_for_tests(0, 0.67);
let ancestors: HashSet<Slot> = vec![0].into_iter().collect();
tower.vote_state.root_slot = Some(0);
tower.record_vote(1, Hash::default());
assert!(tower.is_locked_out(2, &ancestors));
} | rust_cleaned_test_functions.jsonl/61132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
60271,
6068,
12993,
27563,
96328,
22121,
368,
341,
286,
1077,
5206,
21271,
284,
21938,
486,
931,
5478,
32509,
7,
15,
11,
220,
15,
13,
21,
22,
317,
286,
1077,
37518,
25,
18931,
27,
19877,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_coin_portion() {
CoinPortion::new(1_000_000_000_000_001).unwrap();
} | rust_cleaned_test_functions.jsonl/116936 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 56
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
75718,
8716,
290,
368,
341,
286,
26233,
7084,
290,
486,
931,
7,
16,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
16,
568,
15454,
543,
262,
335
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fetch_source_1() {
use crate::tokio_util;
// http_util::fetch_sync_string requires tokio
tokio_util::init(|| {
let (_temp_dir, deno_dir) = test_setup();
let module_name =
"http://localhost:4545/tests/subdir/mt_video_mp2t.t3.ts";
let filename = deno_fs::normalize_path(
deno_dir
.deps_http
.join("localhost_PORT4545/tests/subdir/mt_video_mp2t.t3.ts")
.as_ref(),
);
let mime_file_name = format!("{}.mime", &filename);
let result = deno_dir.fetch_remote_source(module_name, &filename);
assert!(result.is_ok());
let r = result.unwrap().unwrap();
assert_eq!(&(r.source_code), "export const loaded = true;\n");
assert_eq!(&(r.media_type), &msg::MediaType::TypeScript);
assert!(fs::read_to_string(&mime_file_name).is_err());
let _ = fs::write(&mime_file_name, "text/javascript");
let result2 = deno_dir.fetch_local_source(module_name, &filename);
assert!(result2.is_ok());
let r2 = result2.unwrap().unwrap();
assert_eq!(&(r2.source_code), "export const loaded = true;\n");
// Not MediaType::TypeScript due to .mime modification
assert_eq!(&(r2.media_type), &msg::MediaType::JavaScript);
});
} | rust_cleaned_test_functions.jsonl/72744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 595
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
10347,
62,
16,
368,
341,
262,
990,
17717,
486,
29594,
815,
18974,
280,
262,
442,
1758,
18974,
486,
9641,
23008,
3904,
7460,
9628,
815,
198,
262,
9628,
815,
18974,
486,
2327,
79453,
341,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_increment_pc() {
let mut register = Register::new();
assert_eq!(register.get_pc(), 0);
register.increment_pc();
assert_eq!(register.get_pc(), 1);
register.increment_pc();
assert_eq!(register.get_pc(), 2);
} | rust_cleaned_test_functions.jsonl/113010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51482,
35612,
368,
341,
286,
1077,
5206,
4161,
284,
8451,
486,
931,
1428,
286,
2060,
10714,
10297,
6343,
670,
35612,
1507,
220,
15,
317,
286,
4161,
56936,
35612,
543,
286,
2060,
10714,
10297,
6343... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proxy_encoded_size() {
assert!(serialized_size(&0u8) == 1);
assert!(serialized_size(&0u16) == 2);
assert!(serialized_size(&0u32) == 4);
assert!(serialized_size(&0u64) == 8);
// length isize stored as u64
assert!(serialized_size(&"") == 8);
assert!(serialized_size(&"a") == 8 + 1);
assert!(serialized_size(&vec![0u32, 1u32, 2u32]) == 8 + 3 * (4))
} | rust_cleaned_test_functions.jsonl/11960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29712,
73069,
2368,
368,
341,
262,
2060,
10297,
75277,
2368,
2099,
15,
84,
23,
8,
621,
220,
16,
317,
262,
2060,
10297,
75277,
2368,
2099,
15,
84,
16,
21,
8,
621,
220,
17,
317,
262,
2060,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_builder_full_query() {
let query = Timestamp::Hours(11)
.into_query("weather".to_string())
.add_field("temperature", 82)
.add_tag("location", "us-midwest")
.add_tag("season", "summer")
.build();
assert!(query.is_ok(), "Query was empty");
assert_eq!(
query.unwrap(),
r#"weather,location=us-midwest,season=summer temperature=82i 11"#
);
} | rust_cleaned_test_functions.jsonl/40008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
28532,
16372,
5738,
368,
341,
286,
1077,
3239,
284,
32758,
486,
23235,
7,
16,
16,
340,
310,
659,
18122,
5738,
445,
15206,
3263,
983,
3904,
2398,
310,
659,
718,
5013,
445,
34558,
497,
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_discovery_scan_end_wrong_txn_id() {
let mut sched = create_sched();
let (_inspector, sme_inspect) = sme_inspect();
let mlme_req = sched
.enqueue_scan_to_discover(passive_discovery_scan(10))
.expect("expected a ScanRequest");
let txn_id = mlme_req.txn_id;
assert_variant!(
sched.on_mlme_scan_end(
fidl_mlme::ScanEnd { txn_id: txn_id + 1, code: fidl_mlme::ScanResultCode::Success },
&sme_inspect,
),
Err(Error::ScanEndWrongTxnId)
);
} | rust_cleaned_test_functions.jsonl/8146 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9932,
7449,
28857,
6213,
75198,
92299,
842,
368,
341,
286,
1077,
5206,
5575,
284,
1855,
67394,
543,
286,
1077,
5453,
1330,
18997,
11,
90467,
34386,
987,
8,
284,
90467,
34386,
987,
1428,
1789,
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_parse_fstring_nested_spec() {
let source = String::from("{foo:{spec}}");
let parse_ast = parse_fstring(&source).unwrap();
assert_eq!(
parse_ast,
FormattedValue {
value: Box::new(mk_ident("foo", 1, 1)),
conversion: None,
spec: Some(Box::new(FormattedValue {
value: Box::new(mk_ident("spec", 1, 1)),
conversion: None,
spec: None,
})),
}
);
} | rust_cleaned_test_functions.jsonl/10405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
761,
917,
66279,
13594,
368,
341,
286,
1077,
2530,
284,
923,
486,
1499,
13976,
7975,
12547,
9535,
3417,
797,
286,
1077,
4715,
48019,
284,
4715,
761,
917,
2099,
2427,
568,
15454,
1428,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_1() {
let arr: [char; 3] = "abc".chars().arr();
assert_eq!(arr, ['a', 'b', 'c']);
} | rust_cleaned_test_functions.jsonl/131423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
368,
341,
286,
1077,
2890,
25,
508,
1762,
26,
220,
18,
60,
284,
330,
13683,
3263,
19255,
1005,
1118,
543,
286,
2060,
10714,
10297,
1118,
11,
2509,
64,
516,
364,
65,
516,
364,
66,
586... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_commit_and_rollback() {
let mut schema_builder = schema::Schema::builder();
let text_field = schema_builder.add_text_field("text", schema::TEXT);
let index = Index::create_in_ram(schema_builder.build());
let reader = index
.reader_builder()
.reload_policy(ReloadPolicy::Manual)
.try_into()
.unwrap();
let num_docs_containing = |s: &str| {
let searcher = reader.searcher();
let term = Term::from_field_text(text_field, s);
searcher.doc_freq(&term)
};
{
// writing the segment
let mut index_writer = index.writer(3_000_000).unwrap();
index_writer.add_document(doc!(text_field=>"a"));
index_writer.rollback().unwrap();
assert_eq!(index_writer.commit_opstamp(), 0u64);
assert_eq!(num_docs_containing("a"), 0);
{
index_writer.add_document(doc!(text_field=>"b"));
index_writer.add_document(doc!(text_field=>"c"));
}
assert!(index_writer.commit().is_ok());
reader.reload().unwrap();
assert_eq!(num_docs_containing("a"), 0);
assert_eq!(num_docs_containing("b"), 1);
assert_eq!(num_docs_containing("c"), 1);
}
reader.reload().unwrap();
reader.searcher();
} | rust_cleaned_test_functions.jsonl/58886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 722
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36346,
8378,
62,
33559,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
10802,
486,
8632,
486,
17850,
543,
286,
1077,
1467,
5013,
284,
10802,
28532,
1364,
4326,
5013,
445,
1318,
497,
10802,
486,
127... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_product() {
let q1 = Quaternion::from(Euler {
x: Rad(2f32),
y: Rad(1f32),
z: Rad(1f32),
});
let q2 = Quaternion::from(Euler {
x: Rad(1f32),
y: Rad(2f32),
z: Rad(1f32),
});
let q3 = Quaternion::from(Euler {
x: Rad(1f32),
y: Rad(1f32),
z: Rad(2f32),
});
assert_eq!(q1 * q2 * q3, [q1, q2, q3].iter().product());
assert_eq!(q1 * q2 * q3, [q1, q2, q3].iter().cloned().product());
} | rust_cleaned_test_functions.jsonl/38243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
9840,
368,
341,
286,
1077,
2804,
16,
284,
24801,
486,
1499,
10722,
8479,
341,
310,
856,
25,
20605,
7,
17,
69,
18,
17,
1326,
310,
379,
25,
20605,
7,
16,
69,
18,
17,
1326,
310,
1147,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_factor_r1cs() {
let big_g: G1Vector = get_generators("G", 8).into();
let big_h: G1Vector = get_generators("H", 8).into();
let g = G1::from_msg_hash("g".as_bytes());
let h = G1::from_msg_hash("h".as_bytes());
let mut factors = vec![
(
FieldElement::from(2u32),
FieldElement::from(4u32),
FieldElement::from(6u32),
FieldElement::from(48u32),
),
(
FieldElement::from(7u32),
FieldElement::from(5u32),
FieldElement::from(35u32),
FieldElement::from(1225u32),
),
];
let (proof, mut commitments) = {
let mut comms = vec![];
let mut prover_transcript = Transcript::new(b"Factors");
let mut prover = Prover::new(&g, &h, &mut prover_transcript);
for (p, q, r, s) in &factors {
let (com_p, var_p) = prover.commit(p.clone(), FieldElement::random());
let (com_q, var_q) = prover.commit(q.clone(), FieldElement::random());
let (com_r, var_r) = prover.commit(r.clone(), FieldElement::random());
let (_, _, o1) = prover.multiply(var_p.into(), var_q.into());
let (_, _, o2) = prover.multiply(o1.into(), var_r.into());
let lc: LinearCombination = vec![(Variable::One(), s.clone())].iter().collect();
prover.constrain(o2 - lc);
comms.push(com_p);
comms.push(com_q);
comms.push(com_r);
}
let proof = prover.prove(&big_g, &big_h).unwrap();
(proof, comms)
};
println!("Proving done");
let mut verifier_transcript = Transcript::new(b"Factors");
let mut verifier = Verifier::new(&mut verifier_transcript);
for (_, _, _, s) in factors.drain(0..) {
let var_p = verifier.commit(commitments.remove(0));
let var_q = verifier.commit(commitments.remove(0));
let var_r = verifier.commit(commitments.remove(0));
let (_, _, o1) = verifier.multiply(var_p.into(), var_q.into());
let (_, _, o2) = verifier.multiply(o1.into(), var_r.into());
let lc: LinearCombination = vec![(Variable::One(), s)].iter().collect();
verifier.constrain(o2 - lc);
}
assert!(verifier.verify(&proof, &g, &h, &big_g, &big_h).is_ok());
} | rust_cleaned_test_functions.jsonl/37406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18588,
1710,
16,
4837,
368,
341,
1789,
286,
1077,
2409,
1889,
25,
479,
16,
3781,
284,
633,
71963,
2973,
445,
38,
497,
220,
23,
568,
18122,
543,
286,
1077,
2409,
1523,
25,
479,
16,
3781,
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... | 3 |
#[test]
fn test_script_returning_complex_type() {
let ctx = TestContext::new();
block_on_all_using_async_std(async {
let mut con = ctx.multiplexed_async_connection_async_std().await?;
redis::Script::new("return {1, ARGV[1], true}")
.arg("hello")
.invoke_async(&mut con)
.map_ok(|(i, s, b): (i32, String, bool)| {
assert_eq!(i, 1);
assert_eq!(s, "hello");
assert_eq!(b, true);
})
.await
})
.unwrap();
} | rust_cleaned_test_functions.jsonl/105567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14660,
12511,
287,
41522,
1819,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
2504,
4470,
5705,
75180,
28346,
15656,
18285,
341,
286,
1077,
5206,
390,
284,
5635,
744,
9845,
2571,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_str() {
let vals = vec![
("1331.107", 1331107, 3),
("1.0", 10, 1),
("2e1", 2, -1),
("0.00123", 123, 5),
("-123", -123, 0),
("-1230", -1230, 0),
("12.3", 123, 1),
("123e-1", 123, 1),
("1.23e+1", 123, 1),
("1.23E+3", 123, -1),
("1.23E-8", 123, 10),
("-1.23E-10", -123, 12),
];
for &(source, val, scale) in vals.iter() {
let x = BigDecimal::from_str(source).unwrap();
assert_eq!(x.int_val.to_i32().unwrap(), val);
assert_eq!(x.scale, scale);
}
} | rust_cleaned_test_functions.jsonl/75821 | {
"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,
5673,
2895,
368,
341,
286,
1077,
28356,
284,
7486,
90515,
310,
3489,
16,
18,
18,
16,
13,
16,
15,
22,
497,
220,
16,
18,
18,
16,
16,
15,
22,
11,
220,
18,
1326,
310,
3489,
16,
13,
15,
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... | 2 |
#[test]
fn test_get_not_exist_cf() {
let engine = BTreeEngine::new(&[]);
assert!(::panic_hook::recover_safe(|| engine.get_cf("not_exist_cf")).is_err());
} | rust_cleaned_test_functions.jsonl/7233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7913,
35906,
71143,
368,
341,
286,
1077,
4712,
284,
425,
6533,
4571,
486,
931,
2099,
56703,
286,
2060,
10297,
486,
19079,
32005,
486,
74283,
34067,
79453,
4712,
670,
71143,
445,
1921,
35906,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_text() -> Result<(), Box<dyn Error>> {
assert!(matches!(
EmbedFooterBuilder::new("").unwrap_err(),
EmbedFooterTextError::Empty { text }
if text.is_empty()
));
let too_long_len = EmbedFooterBuilder::TEXT_LENGTH_LIMIT + 1;
assert!(matches!(
EmbedFooterBuilder::new("a".repeat(too_long_len)).unwrap_err(),
EmbedFooterTextError::TooLong { text }
if text.len() == too_long_len
));
let expected = EmbedFooter {
icon_url: None,
proxy_icon_url: None,
text: "a footer".to_owned(),
};
let actual = EmbedFooterBuilder::new("a footer")?.build();
assert_eq!(actual, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/68792 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4326,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
2060,
10297,
19914,
33673,
310,
37068,
19445,
3297,
486,
931,
80821,
15454,
9266,
3148,
310,
37068,
19445,
1178,
1454,
486,
3522,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_task_create_okay_contract_id() {
let mut context = get_context(accounts(0));
testing_env!(context.build());
let mut contract = Contract::new();
testing_env!(context
.is_view(false)
.attached_deposit(1000000000040000000200)
.build());
contract.create_task(
accounts(0),
"tick".to_string(),
"0 0 */1 * * *".to_string(),
Some(true),
Some(U128::from(100)),
Some(200),
None,
);
testing_env!(context.is_view(true).build());
assert_eq!(contract.get_tasks(None, None, None).len(), 1);
} | rust_cleaned_test_functions.jsonl/42994 | {
"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,
12184,
8657,
19817,
352,
51499,
842,
368,
341,
286,
1077,
5206,
2266,
284,
633,
8467,
91868,
7,
15,
1106,
286,
7497,
15879,
10297,
2147,
13239,
1423,
286,
1077,
5206,
5116,
284,
19185,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_fli_brun() {
let src = [
0x02, // count 2
3, 0xAB, // length 3
(-4i8) as u8, // length -4
0x01, 0x23, 0x45, 0x67 ];
let expected = [
0xAB, 0xAB, 0xAB,
0x01, 0x23, 0x45, 0x67 ];
const SCREEN_W: usize = 7;
const SCREEN_H: usize = 1;
let mut buf = [0; SCREEN_W * SCREEN_H];
let mut pal = [0; 3 * 256];
let res = decode_fli_brun(&src,
&mut RasterMut::new(SCREEN_W, SCREEN_H, &mut buf, &mut pal));
assert!(res.is_ok());
assert_eq!(&buf[..], &expected[..]);
} | rust_cleaned_test_functions.jsonl/113376 | {
"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,
761,
742,
880,
6108,
368,
341,
286,
1077,
2286,
284,
2278,
310,
220,
15,
87,
15,
17,
11,
981,
442,
1760,
220,
17,
198,
310,
220,
18,
11,
262,
220,
15,
78146,
11,
442,
3084,
220,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_grow_many() {
let (_accounts_dir, paths) = get_temp_accounts_paths(2).unwrap();
let size = 4096;
let accounts = AccountsDb::new_sized(paths, size);
let mut keys = vec![];
for i in 0..9 {
let key = solana_sdk::pubkey::new_rand();
let account = AccountSharedData::new(i + 1, size as usize / 4, &key);
accounts.store_uncached(0, &[(&key, &account)]);
keys.push(key);
}
let ancestors = vec![(0, 0)].into_iter().collect();
for (i, key) in keys.iter().enumerate() {
assert_eq!(
accounts
.load_without_fixed_root(&ancestors, key)
.unwrap()
.0
.lamports(),
(i as u64) + 1
);
}
let mut append_vec_histogram = HashMap::new();
let mut all_storages = vec![];
for slot_storage in accounts.storage.0.iter() {
all_storages.extend(slot_storage.read().unwrap().values().cloned())
}
for storage in all_storages {
*append_vec_histogram.entry(storage.slot()).or_insert(0) += 1;
}
for count in append_vec_histogram.values() {
assert!(*count >= 2);
}
} | rust_cleaned_test_functions.jsonl/1347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 700
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
1889,
651,
22101,
368,
341,
286,
1077,
5453,
26206,
4334,
11,
12716,
8,
284,
633,
11771,
55665,
24152,
7,
17,
568,
15454,
543,
286,
1077,
1379,
284,
220,
19,
15,
24,
21,
280,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_remove_account() {
let location = TempLocation::new();
let inspector = Arc::new(Inspector::new());
request_stream_test(
location.to_persistent_lifetime(),
Arc::clone(&inspector),
|proxy, ahc_client_end| {
async move {
assert_inspect_tree!(inspector, root: {
account_handler: {
lifecycle: "uninitialized",
}
});
proxy.create_account(ahc_client_end, TEST_ACCOUNT_ID.clone().into()).await??;
assert_inspect_tree!(inspector, root: {
account_handler: {
lifecycle: "initialized",
account: {
local_account_id: TEST_ACCOUNT_ID_UINT,
open_client_channels: 0u64,
},
default_persona: {
local_persona_id: AnyProperty,
open_client_channels: 0u64,
},
}
});
// Keep an open channel to an account.
let (account_client_end, account_server_end) = create_endpoints().unwrap();
let (acp_client_end, _) = create_endpoints().unwrap();
proxy.get_account(acp_client_end, account_server_end).await??;
let account_proxy = account_client_end.into_proxy().unwrap();
// Simple check that non-force account removal returns error due to not implemented.
assert_eq!(
proxy.remove_account(FORCE_REMOVE_OFF).await?,
Err(ApiError::Internal)
);
proxy.remove_account(FORCE_REMOVE_ON).await??;
assert_inspect_tree!(inspector, root: {
account_handler: {
lifecycle: "finished",
}
});
// Make sure that the channel is in fact closed.
assert!(account_proxy.get_auth_state().await.is_err());
// We cannot remove twice.
assert_eq!(
proxy.remove_account(FORCE_REMOVE_ON).await?,
Err(ApiError::InvalidRequest)
);
Ok(())
}
},
);
} | rust_cleaned_test_functions.jsonl/36823 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1629
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
13500,
368,
341,
286,
1077,
3728,
284,
19944,
4707,
486,
931,
543,
286,
1077,
44725,
284,
19689,
486,
931,
7,
46230,
486,
931,
1423,
286,
1681,
12673,
4452,
1006,
310,
3728,
2389,
620,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_btreemap() {
assert_eq!(
<BTreeMap<String, u32>>::static_variant_type().as_str(),
"a{su}"
);
// Validate that BTreeMap adds entries to dict in sorted order
let mut m = BTreeMap::new();
let total = 20;
for n in 0..total {
let k = format!("v{:04}", n);
m.insert(k, n as u32);
}
let v = m.to_variant();
let n = v.n_children();
assert_eq!(total, n);
for n in 0..total {
let child = v
.try_child_get::<DictEntry<String, u32>>(n)
.unwrap()
.unwrap();
assert_eq!(*child.value(), n as u32);
}
assert_eq!(BTreeMap::from_variant(&v).unwrap(), m);
} | rust_cleaned_test_functions.jsonl/30225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
10157,
42040,
368,
341,
286,
2060,
10714,
33673,
310,
366,
33,
6533,
2227,
3464,
11,
575,
18,
17,
77595,
1978,
46112,
1819,
1005,
300,
2895,
3148,
310,
330,
64,
90,
27051,
11195,
286,
1439,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_deserialize_object() {
let request =
TestInterfaceRequest::from_args(4 /* opcode */, vec![Arg::Object(OBJECT_VALUE)])
.unwrap();
assert_match!(request, TestInterfaceRequest::Object{arg} => assert_eq!(arg, OBJECT_VALUE));
} | rust_cleaned_test_functions.jsonl/55800 | {
"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,
15768,
9050,
5314,
368,
341,
286,
1077,
1681,
4035,
310,
3393,
5051,
1900,
486,
1499,
8384,
7,
19,
1391,
30028,
36572,
7486,
20703,
2735,
486,
1190,
19238,
10467,
7476,
27144,
394,
659,
15454,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.