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_invalid_yaml() {
let mut tmp = NamedTempFile::new().unwrap();
tmp.write_all("bla: bla".as_bytes()).unwrap();
let _: DynamicConfig<ConfigYaml, ConfigObj> = DynamicConfig::new(String::from(
tmp.into_temp_path().as_os_str().to_str().unwrap()),
false).unwrap();
} | rust_cleaned_test_functions.jsonl/25065 | {
"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,
31433,
64380,
368,
341,
286,
1077,
5206,
4174,
284,
40459,
12151,
1703,
486,
931,
1005,
15454,
543,
286,
4174,
3836,
5705,
445,
64726,
25,
84541,
3263,
300,
12524,
6011,
15454,
543,
286,
1077,
585... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drop() {
static mut DROPS: i32 = 0;
struct Elem;
impl Drop for Elem {
fn drop(&mut self) {
unsafe {
DROPS += 1;
}
}
}
let mut ring = VecDeque::new();
ring.push_back(Elem);
ring.push_front(Elem);
ring.push_back(Elem);
ring.push_front(Elem);
drop(ring);
assert_eq!(unsafe { DROPS }, 4);
} | rust_cleaned_test_functions.jsonl/73718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
368,
341,
262,
1099,
5206,
422,
1285,
5012,
25,
600,
18,
17,
284,
220,
15,
280,
262,
2036,
78768,
280,
262,
11605,
15733,
369,
78768,
341,
286,
5168,
5943,
2099,
6984,
656,
8,
341,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic() {
let cx = mk_ctxt();
let fnia = FakeNodeIdAssigner;
let lcx = LoweringContext::new(&fnia, None);
roundtrip(lower_item(&lcx, "e_item!(&cx,
fn foo() {}
).unwrap()));
} | rust_cleaned_test_functions.jsonl/37634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
368,
341,
262,
1077,
20716,
284,
23789,
93285,
543,
262,
1077,
5168,
685,
284,
36965,
79206,
28933,
261,
280,
262,
1077,
326,
25844,
284,
27536,
287,
1972,
486,
931,
2099,
8822,
685,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_packed() {
let mut test = TestPacked::new();
test.varints = vec![17i32, 1000];
test_serialize_deserialize("22 03 11 e8 07", &test);
let mut test = TestPacked::new();
test.sfixed32s = vec![17i32, 1000];
test_serialize_deserialize("2a 08 11 00 00 00 e8 03 00 00", &test);
} | rust_cleaned_test_functions.jsonl/47068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
620,
11191,
368,
341,
262,
1077,
5206,
1273,
284,
3393,
47,
11191,
486,
931,
543,
262,
1273,
19526,
21042,
284,
7486,
20703,
16,
22,
72,
18,
17,
11,
220,
16,
15,
15,
15,
935,
262,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_getter_only_array() {
let mut fb = FooBar(0);
assert_eq!(0, fb.getter_only_array(0));
assert_eq!(0, fb.getter_only_array(1));
assert_eq!(0, fb.getter_only_array(2));
fb.0 = !(0x1FF << 3);
assert_eq!(0, fb.getter_only_array(0));
assert_eq!(0, fb.getter_only_array(1));
assert_eq!(0, fb.getter_only_array(2));
fb.0 = 0xF << 3;
assert_eq!(0b111, fb.getter_only_array(0));
assert_eq!(0b001, fb.getter_only_array(1));
assert_eq!(0, fb.getter_only_array(2));
fb.0 = 0xF << 6;
assert_eq!(0, fb.getter_only_array(0));
assert_eq!(0b111, fb.getter_only_array(1));
assert_eq!(0b001, fb.getter_only_array(2));
fb.0 = 0xF << 8;
assert_eq!(0, fb.getter_only_array(0));
assert_eq!(0b100, fb.getter_only_array(1));
assert_eq!(0b111, fb.getter_only_array(2));
fb.0 = 0b101_010_110 << 3;
assert_eq!(0b110, fb.getter_only_array(0));
assert_eq!(0b010, fb.getter_only_array(1));
assert_eq!(0b101, fb.getter_only_array(2));
} | rust_cleaned_test_functions.jsonl/2268 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 552
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
465,
18410,
3858,
368,
341,
262,
1077,
5206,
25469,
284,
33428,
3428,
7,
15,
626,
262,
2060,
10714,
10297,
15,
11,
25469,
670,
465,
18410,
3858,
7,
15,
1106,
262,
2060,
10714,
10297,
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_invoke_published_module() {
solana_logger::setup();
let universal_truth = 42;
// First publish the module
let code = format!(
"
module M {{
public universal_truth(): u64 {{
return {};
}}
}}
",
universal_truth
);
let module = LibraAccount::create_module(&code, vec![]);
let keyed_accounts = vec![KeyedAccount::new(&module.key, true, &module.account)];
keyed_accounts[0]
.account
.borrow_mut()
.data
.resize(BIG_ENOUGH, 0);
MoveProcessor::do_finalize(&keyed_accounts).unwrap();
// Next invoke the published module
let amount_to_mint = 84;
let accounts = mint_coins(amount_to_mint).unwrap();
let mut accounts_iter = accounts.iter();
let _script = next_libra_account(&mut accounts_iter).unwrap();
let genesis = next_libra_account(&mut accounts_iter).unwrap();
let sender = next_libra_account(&mut accounts_iter).unwrap();
let code = format!(
"
import 0x0.LibraAccount;
import 0x0.LibraCoin;
import 0x{}.M;
main(payee: address) {{
let amount: u64;
amount = M.universal_truth();
LibraAccount.pay_from_sender(move(payee), move(amount));
return;
}}
",
module.address
);
let script = LibraAccount::create_script(
&genesis.address,
&code,
vec![&module.account.borrow().data],
);
let payee = LibraAccount::create_unallocated(BIG_ENOUGH);
let keyed_accounts = vec![KeyedAccount::new(&script.key, true, &script.account)];
MoveProcessor::do_finalize(&keyed_accounts).unwrap();
let keyed_accounts = vec![
KeyedAccount::new(&script.key, true, &script.account),
KeyedAccount::new(&genesis.key, false, &genesis.account),
KeyedAccount::new(&sender.key, false, &sender.account),
KeyedAccount::new(&module.key, false, &module.account),
KeyedAccount::new(&payee.key, false, &payee.account),
];
MoveProcessor::do_invoke_main(
&keyed_accounts,
sender.address.clone(),
"main".to_string(),
vec![TransactionArgument::Address(payee.address.clone())],
)
.unwrap();
let data_store = MoveProcessor::keyed_accounts_to_data_store(&keyed_accounts[1..]).unwrap();
let sender_resource = data_store.read_account_resource(&sender.address).unwrap();
let payee_resource = data_store.read_account_resource(&payee.address).unwrap();
assert_eq!(amount_to_mint - universal_truth, sender_resource.balance());
assert_eq!(0, sender_resource.sequence_number());
assert_eq!(universal_truth, payee_resource.balance());
assert_eq!(0, payee_resource.sequence_number());
} | rust_cleaned_test_functions.jsonl/71389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1523
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79779,
69524,
10750,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
20178,
49186,
284,
220,
19,
17,
401,
286,
442,
5512,
3415,
279,
4688,
271,
286,
1077,
2038,
284,
3561,
33673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_func() {
let isa = lookup(triple!("x86_64"))
.expect("expect x86 ISA")
.finish(Flags::new(builder()));
let mut context = Context::for_function(create_function(
CallConv::SystemV,
Some(StackSlotData::new(StackSlotKind::ExplicitSlot, 64)),
));
context.compile(&*isa).expect("expected compilation");
let fde = match context
.create_unwind_info(isa.as_ref())
.expect("can create unwind info")
{
Some(crate::isa::unwind::UnwindInfo::SystemV(info)) => {
info.to_fde(Address::Constant(1234))
}
_ => panic!("expected unwind information"),
};
assert_eq!(format!("{:?}", fde), "FrameDescriptionEntry { address: Constant(1234), length: 13, lsda: None, instructions: [(1, CfaOffset(16)), (1, Offset(Register(6), -16)), (4, CfaRegister(Register(6)))] }");
} | rust_cleaned_test_functions.jsonl/40778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 457
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
9596,
368,
341,
286,
1077,
51335,
284,
18615,
7624,
3778,
17223,
87,
23,
21,
62,
21,
19,
5455,
310,
659,
17119,
445,
17119,
856,
23,
21,
84290,
1138,
310,
659,
30150,
7,
9195,
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... | 2 |
#[test]
fn test_scrollcp() {
let mut vm: VimMachine<KeyEvent> = VimMachine::default();
let mut ctx = VimContext::default();
// Place cursored line at the top of the screen with "zt".
let act = Action::Scroll(ScrollStyle::CursorPos(MovePosition::Beginning, Axis::Vertical));
vm.input_key(key!('z'));
vm.input_key(key!('t'));
assert_pop2!(vm, act, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
// Adding a count to "zt" makes it go to a specific line.
let act = Action::Scroll(ScrollStyle::LinePos(MovePosition::Beginning, Count::Contextual));
ctx.action.count = Some(2118);
vm.input_key(key!('2'));
vm.input_key(key!('1'));
vm.input_key(key!('1'));
vm.input_key(key!('8'));
vm.input_key(key!('z'));
vm.input_key(key!('t'));
assert_pop2!(vm, act, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
let actfw = mvop!(EditAction::Motion, MoveType::FirstWord(MoveDir1D::Next), 0);
let actcp = Action::Scroll(ScrollStyle::CursorPos(MovePosition::Beginning, Axis::Vertical));
ctx.action.count = None;
vm.input_key(key!('z'));
vm.input_key(key!(KeyCode::Enter));
assert_pop1!(vm, actfw, ctx);
assert_pop2!(vm, actcp, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
let actfw = mvop!(EditAction::Motion, MoveType::FirstWord(MoveDir1D::Next), 0);
let actlp =
Action::Scroll(ScrollStyle::LinePos(MovePosition::Beginning, Count::Contextual));
ctx.action.count = Some(1312);
vm.input_key(key!('1'));
vm.input_key(key!('3'));
vm.input_key(key!('1'));
vm.input_key(key!('2'));
vm.input_key(key!('z'));
vm.input_key(key!(KeyCode::Enter));
assert_pop1!(vm, actfw, ctx);
assert_pop2!(vm, actlp, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
} | rust_cleaned_test_functions.jsonl/74585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 945
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41407,
4672,
368,
341,
286,
1077,
5206,
10995,
25,
94484,
21605,
42003,
1556,
29,
284,
94484,
21605,
486,
2258,
543,
286,
1077,
5206,
5635,
284,
94484,
1972,
486,
2258,
1428,
286,
442,
10771,
2314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bookstore_path() {
// examples from https://goessner.net/articles/JsonPath/
//the authors of all books in the store
let expr = jsonpath::parse("$.store.book[*].author").unwrap();
assert_eq!(
expr.eval(bookstore_value()),
vec![
json!("Nigel Rees"),
json!("Evelyn Waugh"),
json!("Herman Melville"),
json!("J. R. R. Tolkien")
]
);
// all authors
let expr = jsonpath::parse("$..author").unwrap();
assert_eq!(
expr.eval(bookstore_value()),
vec![
json!("Nigel Rees"),
json!("Evelyn Waugh"),
json!("Herman Melville"),
json!("J. R. R. Tolkien")
]
);
let expr = jsonpath::parse("$.store.*").unwrap();
// But you expect that order stays the same
// that's why bicycle and boot are inverted
assert_eq!(
expr.eval(bookstore_value()),
vec![bicycle_value(), book_value(),]
);
// the price of everything in the store.
let expr = jsonpath::parse("$.store..price").unwrap();
// But you expect that order stays the same
assert_eq!(
expr.eval(bookstore_value()),
vec![
json!(19.95),
json!(8.95),
json!(12.99),
json!(8.99),
json!(22.99),
]
);
// the third book
let expr = jsonpath::parse("$..book[2]").unwrap();
assert_eq!(expr.eval(bookstore_value()), vec![book2_value()]);
// the last book in order
// The following expression is not supported
// use python-like indexing instead
let expr = jsonpath::parse("$..book[-1:]").unwrap();
assert_eq!(expr.eval(bookstore_value()), vec![book3_value()]);
// the first two books
let expr = jsonpath::parse("$..book[0,1]").unwrap();
assert_eq!(
expr.eval(bookstore_value()),
vec![book0_value(), book1_value()]
);
let expr = jsonpath::parse("$..book[:2]").unwrap();
assert_eq!(
expr.eval(bookstore_value()),
vec![book0_value(), book1_value()]
);
// filter all books with isbn number
let expr = jsonpath::parse("$..book[?(@.isbn)]").unwrap();
assert_eq!(
expr.eval(bookstore_value()),
vec![book2_value(), book3_value(),]
);
// filter all books cheapier than 10
let expr = jsonpath::parse("$..book[?(@.price<10)]").unwrap();
assert_eq!(
expr.eval(bookstore_value()),
vec![book0_value(), book2_value(),]
);
// All members of JSON structure
let expr = jsonpath::parse("$..*").unwrap();
// Order is reproducible
// but does not keep same order of json input!
assert_eq!(
expr.eval(bookstore_value()),
vec![
store_value(),
bicycle_value(),
json!("red"),
json!(19.95),
book_value(),
book0_value(),
json!("Nigel Rees"),
json!("reference"),
json!(8.95),
json!("Sayings of the Century"),
book1_value(),
json!("Evelyn Waugh"),
json!("fiction"),
json!(12.99),
json!("Sword of Honour"),
book2_value(),
json!("Herman Melville"),
json!("fiction"),
json!("0-553-21311-3"),
json!(8.99),
json!("Moby Dick"),
book3_value(),
json!("J. R. R. Tolkien"),
json!("fiction"),
json!("0-395-19395-8"),
json!(22.99),
json!("The Lord of the Rings"),
]
);
} | rust_cleaned_test_functions.jsonl/54612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1795
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26421,
4314,
2638,
368,
341,
262,
442,
10295,
504,
3703,
1110,
3346,
433,
1194,
5071,
54034,
14,
5014,
1820,
8680,
262,
442,
1782,
12014,
315,
678,
6467,
304,
279,
3553,
198,
262,
1077,
15169,
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_single_item() {
check(
r#"
macro_rules! m { ($i:item) => ( $i ) }
m! { mod c {} }
"#,
expect![[r#"
macro_rules! m { ($i:item) => ( $i ) }
mod c {}
"#]],
)
} | rust_cleaned_test_functions.jsonl/85231 | {
"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,
19487,
5634,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
314,
1711,
72,
78852,
8,
589,
320,
400,
72,
873,
456,
76,
0,
314,
1463,
272,
4687,
456,
57676,
345,
286,
1720,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_metadata_graph() {
let md = GraphDefValue::initial_metadata();
assert_eq!(&md.plugin_data.unwrap().plugin_name, plugin_names::GRAPHS);
assert_eq!(md.data_class, i32::from(pb::DataClass::BlobSequence));
} | rust_cleaned_test_functions.jsonl/6208 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22220,
14738,
368,
341,
310,
1077,
10688,
284,
12165,
2620,
1130,
486,
9426,
22220,
543,
310,
2060,
10714,
0,
2099,
2277,
26969,
1769,
55395,
1005,
9138,
1269,
11,
9006,
9187,
486,
8626,
2537,
119... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vcx_reject_proof_request() {
let _setup = SetupMocks::init();
let handle = _vcx_disclosed_proof_create_with_request_c_closure(ARIES_PROOF_REQUEST_PRESENTATION).unwrap();
assert_eq!(disclosed_proof::get_state(handle).unwrap(), ProverState::Initial as u32);
let connection_handle = connection::tests::build_test_connection_inviter_requested();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_disclosed_proof_reject_proof(cb.command_handle, handle, connection_handle, Some(cb.get_callback())), error::SUCCESS.code_num);
cb.receive(TimeoutUtils::some_medium()).unwrap();
} | rust_cleaned_test_functions.jsonl/110434 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
1288,
583,
86757,
7893,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
3705,
284,
716,
7362,
87,
37745,
9259,
86757,
8657,
6615,
7893,
666,
72823,
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_connected_components_eight_chessboard() {
let image = chessboard(30, 30);
let components = connected_components(&image, Eight, Luma::black());
let max_component = components.pixels().map(|p| p[0]).max();
assert_eq!(max_component, Some(1u32));
} | rust_cleaned_test_functions.jsonl/114779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43276,
23258,
2204,
491,
4138,
433,
2482,
368,
341,
286,
1077,
2168,
284,
32719,
2482,
7,
18,
15,
11,
220,
18,
15,
317,
286,
1077,
6813,
284,
8433,
23258,
2099,
1805,
11,
35844,
11,
444,
13416... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cvtss2sd() {
assert_emit!(0xf3, 0x0f, 0x5a, 0xc1; cvtss2sd(XMM0, XMM1));
assert_emit!(0xf3, 0x41, 0x0f, 0x5a, 0xdf; cvtss2sd(XMM3, XMM15));
assert_emit!(0xf3, 0x44, 0x0f, 0x5a, 0xc4; cvtss2sd(XMM8, XMM4));
} | rust_cleaned_test_functions.jsonl/85496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
9708,
778,
17,
13446,
368,
341,
286,
2060,
69082,
10297,
15,
5848,
18,
11,
220,
15,
87,
15,
69,
11,
220,
15,
87,
20,
64,
11,
220,
15,
8148,
16,
26,
5544,
83,
778,
17,
13446,
7644,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trivial_turn_sums() {
let lang = English;
let words = Words::new(lang);
let cache = Cache::new(&words);
let secrets1: SecretIndices = [0].into_iter().collect();
let guessed = vec![];
let picks = secrets1.len();
let scores = turn_sums(&words, &secrets1, &guessed, &cache, picks, true);
for (_, score) in scores {
assert_eq!(score, 1);
}
let secrets2: SecretIndices = [0, 1].into_iter().collect();
let guessed = &vec![];
let picks = secrets2.len();
let scores = turn_sums(&words, &secrets2, guessed, &cache, picks, true);
for (_, score) in scores {
assert_eq!(score, 3);
}
} | rust_cleaned_test_functions.jsonl/57272 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
26658,
37274,
643,
6237,
368,
341,
262,
1077,
8688,
284,
6364,
280,
262,
1077,
4244,
284,
27630,
486,
931,
49493,
317,
262,
1077,
6500,
284,
19479,
486,
931,
2099,
5761,
626,
1066,
262,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_serde() -> Result<()> {
let mut buffer: Vec<u8> = vec![0; VoteProgram::get_max_size()];
let mut vote_program = VoteProgram::default();
vote_program.votes = (0..MAX_VOTE_HISTORY).map(|_| Vote::default()).collect();
vote_program.serialize(&mut buffer).unwrap();
assert_eq!(VoteProgram::deserialize(&buffer).unwrap(), vote_program);
Ok(())
} | rust_cleaned_test_functions.jsonl/33980 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
4147,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
26,
34034,
10690,
486,
455,
6345,
2368,
33800,
286,
1077,
5206,
6910,
25096,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_closed_polygon_area() {
let poly = [
Point2D::new(0.0, 0.0),
Point2D::new(5.0, 0.0),
Point2D::new(5.0, 5.0),
Point2D::new(0.0, 5.0),
Point2D::new(0.0, 0.0),
];
assert_eq!(polygon_area(&poly), 25f64);
} | rust_cleaned_test_functions.jsonl/44747 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44697,
73542,
15030,
368,
341,
286,
1077,
9861,
284,
2278,
310,
5126,
17,
35,
486,
931,
7,
15,
13,
15,
11,
220,
15,
13,
15,
1326,
310,
5126,
17,
35,
486,
931,
7,
20,
13,
15,
11,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_commute_interleave() {
let mut line = ::std::iter::repeat(b"bar\n".to_vec());
let hunk1 = owned::Hunk {
added: owned::Block {
start: 1,
lines: Rc::new((&mut line).take(4).collect::<Vec<_>>()),
trailing_newline: true,
},
removed: owned::Block {
start: 0,
lines: Rc::new(vec![]),
trailing_newline: true,
},
};
let hunk2 = owned::Hunk {
added: owned::Block {
start: 1,
lines: Rc::new((&mut line).take(2).collect::<Vec<_>>()),
trailing_newline: true,
},
removed: owned::Block {
start: 0,
lines: Rc::new(vec![]),
trailing_newline: true,
},
};
let (new1, new2) = commute(&hunk1, &hunk2).unwrap();
assert_eq!(new1.added.lines.len(), 2);
assert_eq!(new2.added.lines.len(), 4);
} | rust_cleaned_test_functions.jsonl/33950 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 620
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25149,
1070,
15318,
21510,
368,
341,
286,
1077,
5206,
1555,
284,
3504,
1834,
486,
2015,
486,
30624,
1883,
1,
2257,
1699,
3263,
983,
13251,
1423,
286,
1077,
305,
3122,
16,
284,
12938,
486,
39,
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_match_rule_by_id() {
let data = vec![
"0: 4 1 5",
"1: 2 3 | 3 2",
"2: 4 4 | 5 5",
"3: 4 5 | 5 4",
"4: \"a\"",
"5: \"b\"",
"6: 4 5",
"7: 4 5 4",
];
let rules = load_rules(&data);
assert_eq!(
match_rule_by_id(&rules, 4, "a"),
Some(MatchResult {
matching_part: "a",
remainder: ""
})
);
assert_eq!(match_rule_by_id(&rules, 4, "b"), None);
assert_eq!(match_rule_by_id(&rules, 6, "a"), None);
assert_eq!(
match_rule_by_id(&rules, 6, "ab"),
Some(MatchResult {
matching_part: "ab",
remainder: ""
})
);
assert_eq!(
match_rule_by_id(&rules, 6, "aba"),
Some(MatchResult {
matching_part: "ab",
remainder: "a"
})
);
assert_eq!(
match_rule_by_id(&rules, 7, "aba"),
Some(MatchResult {
matching_part: "aba",
remainder: ""
})
);
assert_eq!(
match_rule_by_id(&rules, 3, "ab"),
Some(MatchResult {
matching_part: "ab",
remainder: ""
})
);
assert_eq!(
match_rule_by_id(&rules, 3, "ba"),
Some(MatchResult {
matching_part: "ba",
remainder: ""
})
);
assert_eq!(match_rule_by_id(&rules, 3, "aab"), None);
} | rust_cleaned_test_functions.jsonl/50121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
21124,
3710,
842,
368,
341,
262,
1077,
821,
284,
7486,
90515,
414,
330,
15,
25,
220,
19,
220,
16,
220,
20,
756,
414,
330,
16,
25,
220,
17,
220,
18,
760,
220,
18,
220,
17,
756,
414,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_var_does_not_add_extra_whitespace() {
check_assist(
extract_variable,
"
fn foo() -> u32 {
$0return 2 + 2$0;
}
",
"
fn foo() -> u32 {
let $0var_name = 2 + 2;
return var_name;
}
",
);
check_assist(
extract_variable,
"
fn foo() -> u32 {
$0return 2 + 2$0;
}
",
"
fn foo() -> u32 {
let $0var_name = 2 + 2;
return var_name;
}
",
);
check_assist(
extract_variable,
"
fn foo() -> u32 {
let foo = 1;
// bar
$0return 2 + 2$0;
}
",
"
fn foo() -> u32 {
let foo = 1;
// bar
let $0var_name = 2 + 2;
return var_name;
}
",
);
} | rust_cleaned_test_functions.jsonl/132840 | {
"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,
39123,
4612,
96374,
7913,
2891,
31858,
86175,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8649,
14635,
345,
310,
6228,
8822,
15229,
368,
1464,
575,
18,
17,
18507,
262,
400,
15,
689,
220,
17,
488... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index_returns_success() {
wrapper(|env| {
let web = env.frontend();
assert!(web.get("/").send()?.status().is_success());
Ok(())
});
} | rust_cleaned_test_functions.jsonl/22209 | {
"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,
3560,
58900,
18632,
368,
341,
286,
13261,
22428,
3160,
91,
341,
310,
1077,
3482,
284,
6105,
23445,
408,
543,
310,
2060,
10297,
2911,
670,
4283,
1827,
6681,
57495,
2829,
1005,
285,
18632,
1423,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_ends_with_vbuf() {
use impls::ROIobuf;
let b0 = [
ROIobuf::from_str("1234"),
ROIobuf::from_str("5678"),
ROIobuf::from_str("9"),
];
assert!(ends_with_vbuf(&b0, b"123456789"));
assert!(ends_with_vbuf(&b0, b"23456789"));
assert!(ends_with_vbuf(&b0, b"3456789"));
assert!(ends_with_vbuf(&b0, b"456789"));
assert!(ends_with_vbuf(&b0, b"56789"));
assert!(ends_with_vbuf(&b0, b"6789"));
assert!(ends_with_vbuf(&b0, b"9"));
assert!(ends_with_vbuf(&b0, b""));
assert!(!ends_with_vbuf(&b0, b"1234567890"));
assert!(!ends_with_vbuf(&b0, b"023456789"));
assert!(!ends_with_vbuf(&b0, b"123456780"));
assert!(!ends_with_vbuf(&b0, b"123450789"));
assert!(!ends_with_vbuf(&b0, b"987654321"));
} | rust_cleaned_test_functions.jsonl/5465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90729,
6615,
2273,
5909,
368,
341,
220,
990,
11605,
82,
486,
71270,
18464,
401,
220,
1077,
293,
15,
284,
2278,
262,
50652,
18464,
486,
1499,
2895,
445,
16,
17,
18,
19,
4461,
262,
50652,
18464,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reserve() {
let mut empty_bytes: HashMap<u8, u8> = HashMap::new();
const MAX_USIZE: usize = usize::MAX;
if let Err(CapacityOverflow) = empty_bytes.try_reserve(MAX_USIZE) {
} else {
panic!("usize::MAX should trigger an overflow!");
}
if let Err(AllocErr) = empty_bytes.try_reserve(MAX_USIZE / 8) {
} else {
panic!("usize::MAX / 8 should trigger an OOM!")
}
} | rust_cleaned_test_functions.jsonl/8532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
89591,
368,
341,
286,
1077,
5206,
4287,
12524,
25,
10528,
34837,
23,
11,
575,
23,
29,
284,
10528,
486,
931,
1428,
286,
733,
8334,
13467,
3282,
25,
22301,
284,
22301,
486,
10586,
401,
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... | 3 |
#[test]
fn test_j_inv() {
let jinv_p = j_inv_p(a(), c());
let jinv = j_inv((a(), b()));
assert_eq!(jinv_p, jinv)
} | rust_cleaned_test_functions.jsonl/11571 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
19996,
368,
341,
262,
1077,
502,
14057,
620,
284,
502,
19996,
620,
2877,
1507,
272,
1423,
262,
1077,
502,
14057,
284,
502,
19996,
1188,
64,
1507,
293,
25138,
262,
2060,
10714,
10297,
73,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_byte_buf_ser() {
let bytes = ByteBuf::new();
assert_eq!(to_string(&bytes).unwrap(), "[]".to_string());
let bytes = ByteBuf::from(vec![1, 2, 3]);
let a = to_string(&bytes).unwrap();
assert_eq!(a, "[1 2 3]".to_string());
} | rust_cleaned_test_functions.jsonl/49345 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
10363,
75861,
368,
341,
262,
1077,
5820,
284,
10906,
15064,
486,
931,
543,
262,
2060,
10714,
10297,
983,
3904,
2099,
9651,
568,
15454,
1507,
330,
1294,
3263,
983,
3904,
5231,
262,
1077,
582... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_detect_compiler_kind_nvcc() {
let f = TestFixture::new();
let creator = new_creator();
let pool = ThreadPool::sized(1);
next_command(&creator, Ok(MockChild::new(exit_status(0), "nvcc\n", "")));
let c = detect_compiler(creator, &f.bins[0], f.tempdir.path(), &[], &pool, None)
.wait()
.unwrap()
.0;
assert_eq!(CompilerKind::C(CCompilerKind::NVCC), c.kind());
} | rust_cleaned_test_functions.jsonl/61641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56457,
80910,
33162,
79430,
638,
368,
341,
286,
1077,
282,
284,
3393,
18930,
486,
931,
543,
286,
1077,
19919,
284,
501,
68532,
543,
286,
1077,
7314,
284,
72716,
486,
82,
1506,
7,
16,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_reader() {
let doc = DOC.as_bytes();
let doc = Cursor::new(doc);
let desered = from_reader(doc).expect("Couldn't deserialize Data");
assert_eq!(
desered,
Data {
base: "https://example.com".into(),
client_id: "adbc01234".into(),
client_secret: "0987dcba".into(),
redirect: "urn:ietf:wg:oauth:2.0:oob".into(),
token: "fedc5678".into(),
}
);
} | rust_cleaned_test_functions.jsonl/39219 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
22306,
368,
341,
286,
1077,
4629,
284,
60355,
5357,
12524,
543,
286,
1077,
4629,
284,
28067,
486,
931,
19153,
317,
286,
1077,
939,
12336,
284,
504,
22306,
19153,
568,
17119,
445,
38987,
944,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exchange_code_with_json_parse_error() {
let client = new_client();
let token = client
.exchange_code(AuthorizationCode::new("ccc".to_string()))
.request(mock_http_client(
vec![
(ACCEPT, "application/json"),
(CONTENT_TYPE, "application/x-www-form-urlencoded"),
(AUTHORIZATION, "Basic YWFhOmJiYg=="),
],
"grant_type=authorization_code&code=ccc",
None,
HttpResponse {
status_code: StatusCode::OK,
headers: vec![(
CONTENT_TYPE,
HeaderValue::from_str("application/json").unwrap(),
)]
.into_iter()
.collect(),
body: "broken json".to_string().into_bytes(),
},
));
assert!(token.is_err());
match token.err().unwrap() {
RequestTokenError::Parse(json_err, _) => {
assert_eq!(".", json_err.path().to_string());
assert_eq!(1, json_err.inner().line());
assert_eq!(1, json_err.inner().column());
assert_eq!(
serde_json::error::Category::Syntax,
json_err.inner().classify()
);
}
other => panic!("Unexpected error: {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/18604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 743
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59212,
4136,
6615,
9455,
21039,
4096,
368,
341,
262,
1077,
2943,
284,
501,
8179,
543,
262,
1077,
3950,
284,
2943,
198,
286,
659,
39568,
4136,
4346,
1553,
2022,
2078,
486,
931,
445,
37054,
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... | 2 |
#[test]
fn test_vis() {
check(
r#"
macro_rules! m {
($vis:vis $name:ident) => { $vis fn $name() {} }
}
m!(pub foo);
m!(foo);
"#,
expect![[r#"
macro_rules! m {
($vis:vis $name:ident) => { $vis fn $name() {} }
}
pub fn foo() {}
fn foo() {}
"#]],
);
} | rust_cleaned_test_functions.jsonl/85252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15887,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
341,
262,
1711,
2682,
25,
2682,
400,
606,
25,
1713,
8,
589,
314,
400,
2682,
5168,
400,
606,
368,
4687,
456,
532,
76,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_without_variables2_test() {
let mut string_cache = StringCache::new();
// test complicated match that caused integer overflow in the past
let mut input_tokens = tokenize("RESULT", &mut string_cache);
input_tokens[0].open_depth = 0;
input_tokens[0].close_depth = 0;
let pred_tokens = tokenize("ui-action character-recruit (on-tick 1 2 (character-recruit (3 4))) (Recruit Logan \"to your team\")", &mut string_cache);
let result = test_match_without_variables(&input_tokens, &pred_tokens);
assert!(result.is_some());
} | rust_cleaned_test_functions.jsonl/122991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
39904,
28182,
17,
4452,
368,
341,
262,
1077,
5206,
914,
11529,
284,
923,
8233,
486,
931,
1428,
262,
442,
1273,
16965,
2432,
429,
8881,
7546,
16484,
304,
279,
3267,
198,
262,
1077,
5206,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bn256_poseidon_hash() {
let rng = &mut thread_rng();
let params = Bn256PoseidonParams::new::<BlakeHasher>();
let input: Vec<Fr> = (0..params.t()).map(|_| rng.gen()).collect();
let output = poseidon_hash::<Bn256>(¶ms, &input[..]);
assert!(output.len() == 1);
} | rust_cleaned_test_functions.jsonl/52981 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58112,
17,
20,
21,
33201,
90456,
8950,
368,
341,
286,
1077,
28422,
284,
609,
6984,
4516,
66849,
543,
286,
1077,
3628,
284,
425,
77,
17,
20,
21,
46315,
90456,
4870,
486,
931,
27638,
91038,
6370,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_op_lte() {
let mut c = Compiler::new();
c.add(Instruction::LoadConst(Value::from(1)));
c.add(Instruction::LoadConst(Value::from(1)));
c.add(Instruction::Lte);
c.add(Instruction::Emit);
let mut output = String::new();
simple_eval(&c.finish().0, (), &mut output).unwrap();
assert_eq!(output, "true");
let mut c = Compiler::new();
c.add(Instruction::LoadConst(Value::from(2)));
c.add(Instruction::LoadConst(Value::from(1)));
c.add(Instruction::Lte);
c.add(Instruction::Emit);
let mut output = String::new();
simple_eval(&c.finish().0, (), &mut output).unwrap();
assert_eq!(output, "false");
} | rust_cleaned_test_functions.jsonl/72130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
907,
665,
368,
341,
262,
1077,
5206,
272,
284,
45631,
486,
931,
543,
262,
272,
1364,
7,
16664,
486,
5879,
19167,
25346,
486,
1499,
7,
16,
4945,
262,
272,
1364,
7,
16664,
486,
5879,
1916... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_template() {
let r = Registry::new();
let mut out = StringOutput::new();
let mut m: BTreeMap<String, String> = BTreeMap::new();
let value = "world".to_string();
m.insert("hello".to_string(), value);
let ctx = Context::wraps(&m).unwrap();
let elements: Vec<TemplateElement> = vec![
RawString("<h1>".to_string()),
Expression(Box::new(HelperTemplate::with_path(Path::with_named_paths(
&["hello"],
)))),
RawString("</h1>".to_string()),
Comment("".to_string()),
];
let template = Template {
elements,
name: None,
mapping: Vec::new(),
};
{
let mut rc = RenderContext::new(None);
template.render(&r, &ctx, &mut rc, &mut out).ok().unwrap();
}
assert_eq!(out.into_string().unwrap(), "<h1>world</h1>".to_string());
} | rust_cleaned_test_functions.jsonl/15108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8693,
368,
341,
262,
1077,
435,
284,
32112,
486,
931,
543,
262,
1077,
5206,
700,
284,
923,
5097,
486,
931,
543,
262,
1077,
5206,
296,
25,
425,
6533,
2227,
3464,
11,
923,
29,
284,
425,
6533,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dim_shared_in_sub_not_allowed() {
let program = r#"
SUB Test
DIM SHARED A
END SUB
"#;
assert_linter_err!(program, QError::IllegalInSubFunction, 3, 24);
} | rust_cleaned_test_functions.jsonl/122478 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10791,
20405,
1243,
5228,
7913,
42155,
368,
341,
286,
1077,
2025,
284,
435,
2,
698,
286,
16140,
3393,
198,
310,
50859,
6434,
32673,
362,
198,
286,
11176,
16140,
198,
286,
5869,
280,
286,
2060,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_all_with_other() {
let source = "> cd+nh <_ -: .; , [ ] # ignored !23455§$%&/()=?";
let instructions = Parser::parse_instructions(&Parser::parse_string(source));
assert_eq!(
instructions,
vec![
Instruction::FWD(1),
Instruction::INC(1),
Instruction::BAK(1),
Instruction::DEC(1),
Instruction::OUT,
Instruction::IN,
Instruction::IF,
Instruction::EIF,
]
);
} | rust_cleaned_test_functions.jsonl/56690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5705,
6615,
30456,
368,
341,
262,
1077,
2530,
284,
28957,
15307,
10,
16719,
366,
62,
52173,
659,
26,
1154,
508,
2279,
671,
12036,
753,
17,
18,
19,
20,
20,
17851,
3,
4,
5,
14,
368,
892... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_array_builder_from_schema() {
let mut fields = Vec::new();
fields.push(Field::new("f1", DataType::Float32, false));
fields.push(Field::new("f2", DataType::Utf8, false));
let mut sub_fields = Vec::new();
sub_fields.push(Field::new("g1", DataType::Int32, false));
sub_fields.push(Field::new("g2", DataType::Boolean, false));
let struct_type = DataType::Struct(sub_fields);
fields.push(Field::new("f3", struct_type, false));
let mut builder = StructBuilder::from_fields(fields, 5);
assert_eq!(3, builder.num_fields());
assert!(builder.field_builder::<Float32Builder>(0).is_some());
assert!(builder.field_builder::<StringBuilder>(1).is_some());
assert!(builder.field_builder::<StructBuilder>(2).is_some());
} | rust_cleaned_test_functions.jsonl/30997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
3858,
28532,
5673,
25371,
368,
341,
286,
1077,
5206,
5043,
284,
11312,
486,
931,
543,
286,
5043,
2552,
57788,
486,
931,
445,
69,
16,
497,
33172,
486,
5442,
18,
17,
11,
895,
1106,
286,
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_from_sequence_err() {
Python::with_gil(|py| {
let items = PyList::new(py, &vec!["a", "b"]);
assert!(PyDict::from_sequence(py, items.to_object(py)).is_err());
});
} | rust_cleaned_test_functions.jsonl/7716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
23735,
9266,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
3589,
284,
5355,
852,
486,
931,
46827,
11,
609,
4083,
0,
1183,
64,
497,
330,
65,
15049,
310,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_stats_size_is_multiple_of_metric_size() {
use ccommon_sys::metric;
use std::mem;
let metric_size = mem::size_of::<metric>();
assert_eq!(mem::size_of::<Metrics>() % metric_size, 0);
} | rust_cleaned_test_functions.jsonl/60608 | {
"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,
15381,
2368,
6892,
45233,
3575,
41294,
2368,
368,
341,
262,
990,
272,
5464,
20344,
486,
15903,
280,
262,
990,
1460,
486,
10536,
401,
262,
1077,
18266,
2368,
284,
1833,
486,
2141,
3575,
27638,
1590... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_quoted_string() {
assert_eq!(quoted_string(&String::from_str("bar")), String::from_str("\"bar\""));
assert_eq!(quoted_string(&String::from_str("bar/baz \"yay\\\"")), String::from_str("\"bar/baz \\\"yay\\\\\\\"\""));
} | rust_cleaned_test_functions.jsonl/8815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
9253,
3904,
368,
341,
286,
2060,
10714,
10297,
63725,
3904,
2099,
703,
486,
1499,
2895,
445,
2257,
35674,
923,
486,
1499,
2895,
38915,
2257,
2105,
4010,
286,
2060,
10714,
10297,
63725,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_nested() {
let mut fields = BTreeMap::new();
insert(&mut fields, "a.b.c", Value::Integer(3));
let expected = fields_from_json(json!({
"a": {
"b":{
"c": 3
}
}
}));
assert_eq!(fields, expected);
} | rust_cleaned_test_functions.jsonl/93987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
66279,
368,
341,
286,
1077,
5206,
5043,
284,
425,
6533,
2227,
486,
931,
543,
286,
5656,
2099,
6984,
5043,
11,
330,
64,
948,
520,
497,
5162,
486,
3486,
7,
18,
3237,
286,
1077,
3601,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_from_stream() {
use serde::Deserialize;
use std::net;
use std::thread;
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct Message {
message: String,
}
let l = net::TcpListener::bind("localhost:20000").unwrap();
thread::spawn(|| {
let l = l;
for stream in l.incoming() {
let mut stream = stream.unwrap();
let read_stream = stream.try_clone().unwrap();
let mut de = Deserializer::from_reader(read_stream);
let request = Message::deserialize(&mut de).unwrap();
let response = Message {
message: request.message,
};
to_writer(&mut stream, &response).unwrap();
}
});
let mut stream = net::TcpStream::connect("localhost:20000").unwrap();
let request = Message {
message: "hi there".to_string(),
};
to_writer(&mut stream, &request).unwrap();
let mut de = Deserializer::from_reader(stream);
let response = Message::deserialize(&mut de).unwrap();
assert_eq!(request, response);
} | rust_cleaned_test_functions.jsonl/29850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 480
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
5673,
12673,
368,
341,
262,
990,
61570,
486,
64465,
280,
262,
990,
1460,
486,
4711,
280,
262,
990,
1460,
486,
4528,
401,
262,
11506,
27098,
42618,
11,
55039,
11,
39900,
11,
48440,
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... | 3 |
#[test]
fn test_statsd_client_with_tags_send_error() {
struct ErrorSink;
impl MetricSink for ErrorSink {
fn emit(&self, _metric: &str) -> io::Result<usize> {
Err(io::Error::from(io::ErrorKind::Other))
}
}
let count = Arc::new(AtomicUsize::new(0));
let count_ref = count.clone();
let handler = move |_err: MetricError| {
count_ref.fetch_add(1, Ordering::Release);
};
let client = StatsdClient::builder("prefix", ErrorSink)
.with_error_handler(handler)
.build();
client.count_with_tags("some.key", 1).with_tag("tier", "web").send();
assert_eq!(1, count.load(Ordering::Acquire));
} | rust_cleaned_test_functions.jsonl/10611 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
6615,
16333,
13565,
4096,
368,
341,
286,
2036,
4600,
45094,
401,
286,
11605,
52458,
45094,
369,
4600,
45094,
341,
310,
5168,
16691,
2099,
721,
11,
716,
15903,
25,
609,
495,
8,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_qvariant_datetime() {
use crate::QMetaType;
let dt = QDateTime::from_date_time_local_timezone(
QDate::from_y_m_d(2019, 10, 23),
QTime::from_h_m_s_ms(10, 30, Some(40), Some(100)),
);
let v = QVariant::from(dt);
let qstring = QString::from_qvariant(v.clone()).unwrap();
let mut s = qstring.to_string();
if s.ends_with(".100") {
s.truncate(s.len() - 4);
}
assert_eq!(s, "2019-10-23T10:30:40");
let qdate = QDate::from_qvariant(v.clone()).unwrap();
assert!(qdate == QDate::from_y_m_d(2019, 10, 23));
assert!(qdate != QDate::from_y_m_d(2019, 10, 24));
let qtime = QTime::from_qvariant(v.clone()).unwrap();
assert!(qtime == QTime::from_h_m_s_ms(10, 30, Some(40), Some(100)));
assert!(qtime != QTime::from_h_m_s_ms(10, 30, Some(40), None));
} | rust_cleaned_test_functions.jsonl/59785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 502
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8976,
15969,
28943,
368,
341,
286,
990,
17717,
486,
48,
12175,
929,
401,
286,
1077,
7594,
284,
98724,
486,
1499,
4164,
3009,
13564,
53193,
1006,
310,
1207,
1916,
486,
1499,
4178,
717,
814,
7,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_unit_or_and_does_flatten() {
let schema = prepopulated_schema();
let known = Known::for_schema(&schema);
let or_query = r#"[:find ?x
:where (or (and [?x :foo/parent ?y]
[?x :foo/age 7]))]"#;
let flat_query = r#"[:find ?x
:where [?x :foo/parent ?y]
[?x :foo/age 7]]"#;
compare_ccs(alg(known, or_query),
alg(known, flat_query));
} | rust_cleaned_test_functions.jsonl/44231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14832,
8734,
8378,
96374,
5081,
14456,
368,
341,
286,
1077,
10802,
284,
855,
8374,
7757,
25371,
543,
286,
1077,
3881,
284,
48286,
486,
1958,
25371,
2099,
17349,
317,
286,
1077,
476,
5738,
284,
256... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_map() {
let s = "{\"a\": \"Dog\", \"b\": {\"variant\":\"Frog\",\
\"fields\":[\"Henry\", 349]}}";
let mut map: TreeMap<string::String, Animal> = super::decode(s).unwrap();
assert_eq!(map.remove(&"a".into_string()), Some(Dog));
assert_eq!(map.remove(&"b".into_string()), Some(Frog("Henry".into_string(), 349)));
} | rust_cleaned_test_functions.jsonl/6557 | {
"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,
15227,
5376,
368,
341,
286,
1077,
274,
284,
54734,
64,
11693,
7245,
48940,
16215,
7245,
65,
11693,
314,
2105,
15969,
23488,
37,
11918,
16215,
5661,
1698,
7245,
9007,
59,
8899,
2105,
63363,
16215,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random_then_unicode() {
let raw_file = include_bytes!("../../testdata/random_then_unicode");
let div_input = include_bytes!("../../testdata/random_then_unicode.ir");
let div_raw = divans_decompress_internal(&*div_input).unwrap();
assert_eq!(raw_file.len(), div_raw.len());
assert_eq!(&raw_file[..], &div_raw[..]);
} | rust_cleaned_test_functions.jsonl/19821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
68367,
54662,
368,
341,
256,
1077,
7112,
2458,
284,
2924,
12524,
17223,
2748,
92425,
79442,
68367,
54662,
797,
256,
1077,
3429,
5898,
284,
2924,
12524,
17223,
2748,
92425,
79442,
68367,
54662,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_next_bucket_to_flush() {
solana_logger::setup();
let bins = 4;
let test = BucketMapHolder::<u64>::new(bins, &Some(AccountsIndexConfig::default()), 1);
let visited = (0..bins)
.into_iter()
.map(|_| AtomicUsize::default())
.collect::<Vec<_>>();
let iterations = bins * 30;
let threads = bins * 4;
let expected = threads * iterations / bins;
(0..threads).into_par_iter().for_each(|_| {
(0..iterations).into_iter().for_each(|_| {
let bin = test.next_bucket_to_flush();
visited[bin].fetch_add(1, Ordering::Relaxed);
});
});
visited.iter().enumerate().for_each(|(bin, visited)| {
assert_eq!(visited.load(Ordering::Relaxed), expected, "bin: {}", bin)
});
} | rust_cleaned_test_functions.jsonl/5424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
38749,
2346,
39213,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
28518,
284,
220,
19,
280,
286,
1077,
1273,
284,
47768,
2227,
8589,
27638,
84,
21,
19,
6831,
931,
1883,
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_rotate_polygon_holes() {
let poly1 = polygon![
exterior: [
(x: 5.0, y: 1.0),
(x: 4.0, y: 2.0),
(x: 4.0, y: 3.0),
(x: 5.0, y: 4.0),
(x: 6.0, y: 4.0),
(x: 7.0, y: 3.0),
(x: 7.0, y: 2.0),
(x: 6.0, y: 1.0),
(x: 5.0, y: 1.0)
],
interiors: [
[
(x: 5.0, y: 1.3),
(x: 5.5, y: 2.0),
(x: 6.0, y: 1.3),
(x: 5.0, y: 1.3),
],
[
(x: 5., y: 2.3),
(x: 5.5, y: 3.0),
(x: 6., y: 2.3),
(x: 5., y: 2.3),
],
],
];
let rotated = poly1.rotate(-15.0);
let correct_outside = vec![
Coordinate::from((4.628808519201685, 1.180520783117658)),
Coordinate::from((3.921701738015137, 2.4052656545092472)),
Coordinate::from((4.180520783117657, 3.3711914807983154)),
Coordinate::from((5.405265654509247, 4.078298261984863)),
Coordinate::from((6.371191480798315, 3.8194792168823426)),
Coordinate::from((7.0782982619848624, 2.594734345490753)),
Coordinate::from((6.819479216882343, 1.628808519201685)),
Coordinate::from((5.594734345490753, 0.9217017380151373)),
Coordinate::from((4.628808519201685, 1.180520783117658)),
];
let correct_inside = vec![
Coordinate::from((4.706454232732441, 1.4702985310043786)),
Coordinate::from((5.37059047744874, 2.017037086855466)),
Coordinate::from((5.672380059021509, 1.2114794859018578)),
Coordinate::from((4.706454232732441, 1.4702985310043786)),
];
assert_eq!(rotated.exterior().0, correct_outside);
assert_eq!(rotated.interiors()[0].0, correct_inside);
} | rust_cleaned_test_functions.jsonl/46759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60834,
73542,
1523,
7151,
368,
341,
286,
1077,
9861,
16,
284,
29372,
90515,
310,
27263,
25,
2278,
394,
320,
87,
25,
220,
20,
13,
15,
11,
379,
25,
220,
16,
13,
15,
1326,
394,
320,
87,
25,
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_get_info() {
let mut rng = ThreadRng256 {};
let user_immediately_present = |_| Ok(());
let mut ctap_state = CtapState::new(&mut rng, user_immediately_present);
let info_reponse = ctap_state.process_command(&[0x04], DUMMY_CHANNEL_ID);
#[cfg(feature = "with_ctap2_1")]
let mut expected_response = vec![0x00, 0xA9, 0x01];
#[cfg(not(feature = "with_ctap2_1"))]
let mut expected_response = vec![0x00, 0xA6, 0x01];
// The difference here is a longer array of supported versions.
let mut version_count = 0;
// CTAP 2 is always supported
version_count += 1;
#[cfg(feature = "with_ctap1")]
{
version_count += 1;
}
#[cfg(feature = "with_ctap2_1")]
{
version_count += 1;
}
expected_response.push(0x80 + version_count);
#[cfg(feature = "with_ctap1")]
expected_response.extend(&[0x66, 0x55, 0x32, 0x46, 0x5F, 0x56, 0x32]);
expected_response.extend(&[0x68, 0x46, 0x49, 0x44, 0x4F, 0x5F, 0x32, 0x5F, 0x30]);
#[cfg(feature = "with_ctap2_1")]
expected_response.extend(&[
0x6C, 0x46, 0x49, 0x44, 0x4F, 0x5F, 0x32, 0x5F, 0x31, 0x5F, 0x50, 0x52, 0x45,
]);
expected_response.extend(&[
0x02, 0x81, 0x6B, 0x68, 0x6D, 0x61, 0x63, 0x2D, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74,
0x03, 0x50,
]);
expected_response.extend(&ctap_state.persistent_store.aaguid().unwrap());
expected_response.extend(&[
0x04, 0xA3, 0x62, 0x72, 0x6B, 0xF5, 0x62, 0x75, 0x70, 0xF5, 0x69, 0x63, 0x6C, 0x69,
0x65, 0x6E, 0x74, 0x50, 0x69, 0x6E, 0xF4, 0x05, 0x19, 0x04, 0x00, 0x06, 0x81, 0x01,
]);
#[cfg(feature = "with_ctap2_1")]
expected_response.extend(
[
0x09, 0x81, 0x63, 0x75, 0x73, 0x62, 0x0A, 0x81, 0xA2, 0x63, 0x61, 0x6C, 0x67, 0x26,
0x64, 0x74, 0x79, 0x70, 0x65, 0x6A, 0x70, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x2D, 0x6B,
0x65, 0x79, 0x0D, 0x04,
]
.iter(),
);
assert_eq!(info_reponse, expected_response);
} | rust_cleaned_test_functions.jsonl/73225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
3109,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
9321,
286,
1077,
1196,
17895,
43187,
36976,
284,
66091,
7622,
7,
1423,
286,
1077,
5206,
20251,
391,
4387,
284,
356,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_4() {
let ikm = decode("0b0b0b0b0b0b0b0b0b0b0b").unwrap();
let salt = decode("000102030405060708090a0b0c").unwrap();
let info = decode("f0f1f2f3f4f5f6f7f8f9").unwrap();
let expected_prk = decode(
"67409c9cac28b52ee9fad91c2fda999f7ca22e3434f0ae772863836568ad6a7f10cf113bfddd560129a594a8f52385c2d661d785d29ce93a11400c920683181d",
).unwrap();
let expected_okm = decode(
"7413e8997e020610fbf6823f2ce14bff01875db1ca55f68cfcf3954dc8aff53559bd5e3028b080f7c068",
)
.unwrap();
hkdf_test_runner(
Some(&expected_prk),
&expected_okm,
&salt,
&ikm,
&info,
expected_okm.len(),
true,
);
} | rust_cleaned_test_functions.jsonl/10123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 497
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
19,
368,
341,
286,
1077,
13361,
76,
284,
16895,
445,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
1827,
15454,
543,
286,
1077,
120... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_messages() {
let packet =
hex::decode("000055aa00000000000000090000000c00000000b051ab030000aa55").unwrap();
let expected = Message {
command: Some(CommandType::HeartBeat),
payload: Vec::new(),
seq_nr: Some(0),
ret_code: Some(0),
};
let mp = MessageParser::create("3.1", None).unwrap();
let (buf, messages) = mp.parse_messages(&packet).unwrap();
assert_eq!(messages[0], expected);
assert_eq!(buf, &[] as &[u8]);
} | rust_cleaned_test_functions.jsonl/39162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
23428,
368,
341,
286,
1077,
10151,
4035,
310,
12371,
486,
18196,
445,
15,
15,
15,
15,
20,
20,
5305,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
24,
15,
15,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_beta_encoding() -> io::Result<()> {
let data = [
6, // Beta encoding ID
2, // args.len
0, // offset
8, // len
];
let mut reader = &data[..];
let encoding = read_encoding(&mut reader)?;
assert_eq!(encoding, Encoding::Beta(0, 8));
Ok(())
} | rust_cleaned_test_functions.jsonl/5077 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
49292,
37613,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
821,
284,
2278,
310,
220,
21,
11,
442,
34243,
11170,
3034,
198,
310,
220,
17,
11,
442,
2827,
19406,
198,
310,
220,
15,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_delete_records() {
let mut collection = setup_collection();
collection.create().unwrap();
for _ in 0..10 {
collection.new_record().create().unwrap();
}
collection.delete_records().unwrap();
let records = collection.list_records();
assert_eq!(records.unwrap().len(), 0);
} | rust_cleaned_test_functions.jsonl/63506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
31279,
368,
341,
286,
1077,
5206,
4426,
284,
6505,
25019,
543,
286,
4426,
2520,
1005,
15454,
543,
286,
369,
716,
304,
220,
15,
496,
16,
15,
341,
310,
4426,
4618,
14192,
1005,
3182,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_lt_dyn_scalar_with_dict() {
let key_builder = PrimitiveBuilder::<Int8Type>::new(3);
let value_builder = PrimitiveBuilder::<Int32Type>::new(2);
let mut builder = PrimitiveDictionaryBuilder::new(key_builder, value_builder);
builder.append(123).unwrap();
builder.append_null().unwrap();
builder.append(23).unwrap();
let array = builder.finish();
let a_eq = lt_dyn_scalar(&array, 123).unwrap();
assert_eq!(
a_eq,
BooleanArray::from(vec![Some(false), None, Some(true)])
);
} | rust_cleaned_test_functions.jsonl/98212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39164,
69213,
41652,
6615,
5243,
368,
341,
286,
1077,
1376,
28532,
284,
51460,
3297,
27638,
1072,
23,
929,
6831,
931,
7,
18,
317,
286,
1077,
897,
28532,
284,
51460,
3297,
27638,
1072,
18,
17,
92... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pre_scan() {
let up_name = Name::from_str("www.example.com").unwrap();
let not_zone = Name::from_str("not.zone.com").unwrap();
let authority = create_example();
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(not_zone.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 24)))
.clone()],),
Err(ResponseCode::NotZone)
);
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::ANY)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::NULL(NULL::new()))
.clone()],),
Err(ResponseCode::FormErr)
);
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::AXFR)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::NULL(NULL::new()))
.clone()],),
Err(ResponseCode::FormErr)
);
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::IXFR)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::NULL(NULL::new()))
.clone()],),
Err(ResponseCode::FormErr)
);
assert!(authority
.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 24)))
.clone()])
.is_ok());
assert!(authority
.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::NULL(NULL::new()))
.clone()])
.is_ok());
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::ANY)
.set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 24)))
.clone()],),
Err(ResponseCode::FormErr)
);
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(0)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::ANY)
.set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 24)))
.clone()],),
Err(ResponseCode::FormErr)
);
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(0)
.set_rr_type(RecordType::AXFR)
.set_dns_class(DNSClass::ANY)
.set_rdata(RData::NULL(NULL::new()))
.clone()],),
Err(ResponseCode::FormErr)
);
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(0)
.set_rr_type(RecordType::IXFR)
.set_dns_class(DNSClass::ANY)
.set_rdata(RData::NULL(NULL::new()))
.clone()],),
Err(ResponseCode::FormErr)
);
assert!(authority
.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(0)
.set_rr_type(RecordType::ANY)
.set_dns_class(DNSClass::ANY)
.set_rdata(RData::NULL(NULL::new()))
.clone()])
.is_ok());
assert!(authority
.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(0)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::ANY)
.set_rdata(RData::NULL(NULL::new()))
.clone()])
.is_ok());
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::NONE)
.set_rdata(RData::NULL(NULL::new()))
.clone()],),
Err(ResponseCode::FormErr)
);
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(0)
.set_rr_type(RecordType::ANY)
.set_dns_class(DNSClass::NONE)
.set_rdata(RData::NULL(NULL::new()))
.clone()],),
Err(ResponseCode::FormErr)
);
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(0)
.set_rr_type(RecordType::AXFR)
.set_dns_class(DNSClass::NONE)
.set_rdata(RData::NULL(NULL::new()))
.clone()],),
Err(ResponseCode::FormErr)
);
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(0)
.set_rr_type(RecordType::IXFR)
.set_dns_class(DNSClass::NONE)
.set_rdata(RData::NULL(NULL::new()))
.clone()],),
Err(ResponseCode::FormErr)
);
assert!(authority
.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(0)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::NONE)
.set_rdata(RData::NULL(NULL::new()))
.clone()])
.is_ok());
assert!(authority
.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(0)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::NONE)
.set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 24)))
.clone()])
.is_ok());
assert_eq!(
authority.pre_scan(&[Record::new()
.set_name(up_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::CH)
.set_rdata(RData::NULL(NULL::new()))
.clone()],),
Err(ResponseCode::FormErr)
);
} | rust_cleaned_test_functions.jsonl/48168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3666
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
28857,
368,
341,
262,
1077,
705,
1269,
284,
3988,
486,
1499,
2895,
445,
2136,
7724,
905,
1827,
15454,
543,
262,
1077,
537,
28692,
284,
3988,
486,
1499,
2895,
445,
1921,
57808,
905,
1827,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_export_incompatible_change() {
// bip44/49/etc format
let descriptor = "wpkh(xprv9s21ZrQH143K4CTb63EaMxja1YiTnSEWKMbn23uoEnAzxjdUJRQkazCAtzxGm4LSoTSVTptoV9RbchnKPW9HxKtZumdyxyikZFDLhogJ5Uj/44'/0'/0'/0/*)";
let change_descriptor = "wpkh(xprv9s21ZrQH143K4CTb63EaMxja1YiTnSEWKMbn23uoEnAzxjdUJRQkazCAtzxGm4LSoTSVTptoV9RbchnKPW9HxKtZumdyxyikZFDLhogJ5Uj/50'/0'/1/*)";
let wallet = Wallet::new_offline(
descriptor,
Some(change_descriptor),
Network::Bitcoin,
get_test_db(),
)
.unwrap();
WalletExport::export_wallet(&wallet, "Test Label", true).unwrap();
} | rust_cleaned_test_functions.jsonl/21475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27114,
1243,
34842,
15947,
368,
341,
1789,
286,
442,
28878,
19,
19,
14,
19,
24,
47047,
3561,
271,
286,
1077,
16414,
284,
330,
8421,
30664,
2075,
649,
85,
24,
82,
17,
16,
57,
81,
48,
39,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_init() {
let mut mock = mock::Mock::default();
let mut ctx = mock.create_ctx();
let mut meta = Metadata {
..Default::default()
};
let genesis = Default::default();
Module::<Accounts, Consensus>::init_or_migrate(&mut ctx, &mut meta, genesis);
} | rust_cleaned_test_functions.jsonl/52592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
368,
341,
262,
1077,
5206,
7860,
284,
7860,
486,
11571,
486,
2258,
543,
262,
1077,
5206,
5635,
284,
7860,
2520,
15147,
543,
262,
1077,
5206,
8823,
284,
33589,
341,
286,
5241,
3675,
486,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_that_we_dont_need_imports_for_this_macro_to_work() {
test::<&str>();
test_that_parsers_with_unnamed_types_can_be_in_same_scope::<&str>();
} | rust_cleaned_test_functions.jsonl/3955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70197,
45922,
814,
544,
71506,
18434,
82,
5478,
24868,
58810,
2346,
11498,
368,
341,
262,
1273,
27638,
5,
495,
3913,
262,
1273,
70197,
620,
40488,
6615,
4907,
30245,
9763,
27421,
21263,
1243,
33574,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_join() {
t!(v: Path::new(b"a/b/c").join(b".."), b"a/b");
t!(v: Path::new(b"/a/b/c").join(b"d"), b"/a/b/c/d");
t!(v: Path::new(b"a/\x80/c").join(b"\xFF"), b"a/\x80/c/\xFF");
t!(s: Path::new("a/b/c").join(".."), "a/b");
t!(s: Path::new("/a/b/c").join("d"), "/a/b/c/d");
t!(s: Path::new("a/b").join("c/d"), "a/b/c/d");
t!(s: Path::new("a/b").join("/c/d"), "/c/d");
t!(s: Path::new(".").join("a/b"), "a/b");
t!(s: Path::new("/").join("a/b"), "/a/b");
} | rust_cleaned_test_functions.jsonl/7687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
368,
341,
286,
259,
10297,
85,
25,
7933,
486,
931,
1883,
56693,
3470,
2899,
1827,
5987,
1883,
62923,
3975,
293,
56693,
3470,
797,
286,
259,
10297,
85,
25,
7933,
486,
931,
1883,
3115,
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... | 1 |
#[test]
fn test_tree_rooting() {
let graph = UnweightedAdjacencyList::new_undirected(
9,
&[
[0, 1],
[2, 1],
[2, 3],
[3, 4],
[5, 3],
[2, 6],
[6, 7],
[6, 8],
],
);
let root = Node::from_adjacency_list(&graph, 6);
// Rooted at 6 the root should look like:
println!("{:?}", &root);
assert_eq!(
root,
Node {
id: 6,
children: vec![
Node {
id: 2,
children: vec![
Node {
id: 1,
children: vec![Node::new(0)]
},
Node {
id: 3,
children: vec![Node::new(4), Node::new(5)]
}
]
},
Node::new(7),
Node::new(8)
]
}
);
let root = Node::from_adjacency_list(&graph, 3);
// Rooted at 3 the root should look like:
println!("{:?}", &root);
assert_eq!(
root,
Node {
id: 3,
children: vec![
Node {
id: 2,
children: vec![
Node {
id: 1,
children: vec![Node::new(0)]
},
Node {
id: 6,
children: vec![Node::new(7), Node::new(8)]
}
]
},
Node::new(4),
Node::new(5)
]
}
);
} | rust_cleaned_test_functions.jsonl/22998 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1626
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11663,
12993,
287,
368,
341,
286,
1077,
4771,
284,
1230,
79796,
54866,
40624,
852,
486,
931,
62,
1241,
74612,
1006,
310,
220,
24,
345,
310,
609,
9640,
394,
508,
15,
11,
220,
16,
1259,
394,
508... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_message_hash() {
let program_id0 = Pubkey::from_str("4uQeVj5tqViQh7yWWGStvkEG1Zmhx6uasJtWCJziofM").unwrap();
let program_id1 = Pubkey::from_str("8opHzTAnfzRpPEx21XtnrVTX28YQuCpAjcn1PczScKh").unwrap();
let id0 = Pubkey::from_str("CiDwVBFgWV9E5MvXWoLgnEgn2hK7rJikbvfWavzAQz3").unwrap();
let id1 = Pubkey::from_str("GcdayuLaLyrdmUu324nahyv33G5poQdLUEZ1nEytDeP").unwrap();
let id2 = Pubkey::from_str("LX3EUdRUBUa3TbsYXLEUdj9J3prXkWXvLYSWyYyc2Jj").unwrap();
let id3 = Pubkey::from_str("QRSsyMWN1yHT9ir42bgNZUNZ4PdEhcSWCrL2AryKpy5").unwrap();
let instructions = vec![
Instruction::new_with_bincode(program_id0, &0, vec![AccountMeta::new(id0, false)]),
Instruction::new_with_bincode(program_id0, &0, vec![AccountMeta::new(id1, true)]),
Instruction::new_with_bincode(
program_id1,
&0,
vec![AccountMeta::new_readonly(id2, false)],
),
Instruction::new_with_bincode(
program_id1,
&0,
vec![AccountMeta::new_readonly(id3, true)],
),
];
let message = Message::new(&instructions, Some(&id1));
assert_eq!(
message.hash(),
Hash::from_str("CXRH7GHLieaQZRUjH1mpnNnUZQtU4V4RpJpAFgy77i3z").unwrap()
)
} | rust_cleaned_test_functions.jsonl/55538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 827
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
8950,
368,
341,
16885,
286,
1077,
2025,
842,
15,
284,
22611,
792,
486,
1499,
2895,
445,
19,
84,
48,
68,
53,
73,
20,
83,
80,
35544,
48,
71,
22,
88,
18985,
38,
623,
48363,
9376,
16,
57... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_singleton() {
let a1 = Bump::new();
let a2 = Bump::new();
assert_eq!(map![&a1; 1 => 2], map![&a2; 1 => 2]);
} | rust_cleaned_test_functions.jsonl/118071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82119,
368,
341,
286,
1077,
264,
16,
284,
425,
1510,
486,
931,
543,
286,
1077,
264,
17,
284,
425,
1510,
486,
931,
543,
286,
2060,
10714,
10297,
2186,
20703,
5,
64,
16,
26,
220,
16,
589,
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 |
#[test]
fn test_serialize_and_deserialize_create() {
let orig = ProgramInstruction::CreateBucket {
data: &[1, 2, 3, 4, 5, 6],
size: 80,
bump_seed: 42,
};
let bs = orig.serialize();
let new = parse_program_instruction(bs.as_ref()).unwrap();
assert_eq!(orig, new);
} | rust_cleaned_test_functions.jsonl/128155 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
8378,
15768,
9050,
8657,
368,
341,
286,
1077,
2713,
284,
6687,
16664,
486,
4021,
36018,
341,
310,
821,
25,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_ip_cow() {
let test: Cow<'static, str> = "1.1.1.1".into();
assert_eq!(validate_ip(test), true);
let test: Cow<'static, str> = String::from("1.1.1.1").into();
assert_eq!(validate_ip(test), true);
let test: Cow<'static, str> = "2a02::223:6cff :fe8a:2e8a".into();
assert_eq!(validate_ip(test), false);
let test: Cow<'static, str> = String::from("2a02::223:6cff :fe8a:2e8a").into();
assert_eq!(validate_ip(test), false);
} | rust_cleaned_test_functions.jsonl/46416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
10385,
666,
363,
368,
341,
286,
1077,
1273,
25,
21851,
18291,
1978,
11,
607,
29,
284,
330,
16,
13,
16,
13,
16,
13,
16,
3263,
18122,
543,
286,
2060,
10714,
10297,
7067,
10385,
8623,
701,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_alternator_polynomial() {
use ark_poly::Evaluations;
let domain_k = GeneralEvaluationDomain::<Fr>::new(1 << 4).unwrap();
let domain_h = GeneralEvaluationDomain::<Fr>::new(1 << 3).unwrap();
let domain_h_elems = domain_h
.elements()
.collect::<std::collections::HashSet<_>>();
let alternator_poly_evals = domain_k
.elements()
.map(|e| {
if domain_h_elems.contains(&e) {
Fr::one()
} else {
Fr::zero()
}
})
.collect();
let v_k: DenseOrSparsePolynomial<_> = domain_k.vanishing_polynomial().into();
let v_h: DenseOrSparsePolynomial<_> = domain_h.vanishing_polynomial().into();
let (divisor, remainder) = v_k.divide_with_q_and_r(&v_h).unwrap();
assert!(remainder.is_zero());
println!("Divisor: {:?}", divisor);
println!(
"{:#?}",
divisor
.coeffs
.iter()
.filter_map(|f| if !f.is_zero() {
Some(f.into_repr())
} else {
None
})
.collect::<Vec<_>>()
);
for e in domain_h.elements() {
println!("{:?}", divisor.evaluate(&e));
}
// Let p = v_K / v_H;
// is the constant polynomial c^{-1}.
// way to calculate c?
let alternator_poly =
Evaluations::from_vec_and_domain(alternator_poly_evals, domain_k).interpolate();
let (quotient, remainder) = DenseOrSparsePolynomial::from(alternator_poly.clone())
.divide_with_q_and_r(&DenseOrSparsePolynomial::from(divisor))
.unwrap();
assert!(remainder.is_zero());
println!("quotient: {:?}", quotient);
println!(
"{:#?}",
quotient
.coeffs
.iter()
.filter_map(|f| if !f.is_zero() {
Some(f.into_repr())
} else {
None
})
.collect::<Vec<_>>()
);
println!("{:?}", alternator_poly);
} | rust_cleaned_test_functions.jsonl/89136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79728,
850,
47323,
25358,
368,
341,
286,
990,
55217,
36133,
486,
36,
25510,
804,
280,
286,
1077,
7947,
4698,
284,
3251,
82363,
13636,
27638,
22560,
6831,
931,
7,
16,
1115,
220,
19,
568,
15454,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_convert_to_f64() {
let cases = vec![
("2012-12-31 11:30:45.123456", 4, 20121231113045.1235f64),
("2012-12-31 11:30:45.123456", 6, 20121231113045.123456f64),
("2012-12-31 11:30:45.123456", 0, 20121231113045f64),
("2012-12-31 11:30:45.999999", 0, 20121231113046f64),
("2017-01-05 08:40:59.575601", 0, 20170105084100f64),
("2017-01-05 23:59:59.575601", 0, 20170106000000f64),
("0000-00-00 00:00:00", 6, 0f64),
];
let mut ctx = EvalContext::default();
for (s, fsp, expect) in cases {
let t = Time::parse_datetime(&mut ctx, s, fsp, true).unwrap();
let get: f64 = t.convert(&mut ctx).unwrap();
assert!(
(expect - get).abs() < std::f64::EPSILON,
"expect: {}, got: {}",
expect,
get
);
}
} | rust_cleaned_test_functions.jsonl/40474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 545
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
2346,
761,
21,
19,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
17,
15,
16,
17,
12,
16,
17,
12,
18,
16,
220,
16,
16,
25,
18,
15,
25,
19,
20,
13,
16,
17,
18,
19,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_permissions_from() {
let p = internal_permissions::Permissions::from(130);
assert_eq!(p.manage_permissions, true);
assert_eq!(p.manage_users, false);
assert_eq!(p.manage_groups, false);
assert_eq!(p.manage_tokens, false);
assert_eq!(p.set_internal_permissions, false);
assert_eq!(p.get_users, false);
assert_eq!(p.get_groups, true);
assert_eq!(p.get_permissions, false);
assert_eq!(p.manage_long_token, false);
} | rust_cleaned_test_functions.jsonl/106526 | {
"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,
44767,
5673,
368,
341,
286,
1077,
281,
284,
5306,
44767,
486,
23851,
486,
1499,
7,
16,
18,
15,
317,
286,
2060,
10714,
10297,
79,
50821,
44767,
11,
830,
317,
286,
2060,
10714,
10297,
79,
50821,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_form() {
let mut f = WaveReader::open("tests/media/izotope_test.wav").unwrap();
let mut buf: Vec<u8> = vec![];
f.read_list(ADTL_SIG, &mut buf).unwrap();
assert_ne!(buf.len(), 0);
} | rust_cleaned_test_functions.jsonl/134524 | {
"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,
2019,
7915,
368,
341,
262,
1077,
5206,
282,
284,
31318,
5062,
486,
2508,
445,
23841,
29506,
14,
449,
50682,
4452,
29864,
1827,
15454,
543,
262,
1077,
5206,
6607,
25,
11312,
34837,
23,
29,
284,
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_get_client_empty() -> anyhow::Result<()> {
let storage = InMemoryStorage::new();
let mut txn = storage.txn()?;
let maybe_client = txn.get_client(Uuid::new_v4())?;
assert!(maybe_client.is_none());
Ok(())
} | rust_cleaned_test_functions.jsonl/16731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8179,
15124,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
5819,
284,
758,
10642,
5793,
486,
931,
543,
286,
1077,
5206,
49721,
284,
5819,
33807,
77,
94136,
286,
1077,
7196,
8179,
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_maximum_age_filtering() -> Result<(), Error> {
#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
let unix_time = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_millis() as i64;
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
let unix_time = Date::now() as i64;
let kp = SampiKeyPair::new();
let sampis: Vec<_> = vec![10000, 5000, 3000, 2000, 1000]
.into_iter()
.filter_map(|i| {
kp.new_sampi()
.with_unix_time(unix_time - i)
.build(vec![])
.ok()
})
.collect();
let mut filter = SampiFilter::new();
filter.maximum_unix_time_age = Some(3500);
let current_unix_time = get_unix_time_millis();
dbg!(current_unix_time);
assert_eq!(
sampis
.into_iter()
.filter(|s| filter.matches(s, current_unix_time))
.count(),
3
);
Ok(())
} | rust_cleaned_test_functions.jsonl/67873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 532
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
93581,
32053,
8727,
287,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
11506,
14072,
40268,
24772,
8637,
34330,
284,
330,
86,
10530,
18,
17,
3975,
2169,
29387,
284,
330,
86,
10215,
2761,
921,
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_update_check_retries_backoff() {
block_on(async {
let config = config_generator();
let mut timer = MockTimer::new();
timer.expect_range(Duration::from_millis(500), Duration::from_millis(1500));
timer.expect_range(Duration::from_millis(1500), Duration::from_millis(2500));
let response = StateMachineBuilder::new(
StubPolicyEngine,
MockHttpRequest::empty(),
StubInstaller::default(),
timer,
MockMetricsReporter::new(false),
Rc::new(Mutex::new(StubStorage)),
config,
make_test_app_set(),
)
.oneshot()
.await;
assert_matches!(
response,
Err(UpdateCheckError::OmahaRequest(OmahaRequestError::HttpStatus(_)))
);
});
} | rust_cleaned_test_functions.jsonl/126406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 501
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
7200,
1288,
4543,
3895,
1847,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2193,
284,
2193,
25813,
543,
310,
1077,
5206,
9021,
284,
14563,
10105,
486,
931,
543,
310,
9021,
25952,
9698,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ancestry() {
assert_eq!(
(Item::new(), Item::new()),
Item::new().ancestry(&Item::new())
);
assert_eq!(
(Item::new(), Item::with_item(&["a"])),
Item::new().ancestry(&Item::with_item(&["a"]))
);
assert_eq!(
(Item::new(), Item::with_item(&["a", "b"])),
Item::new().ancestry(&Item::with_item(&["a", "b"]))
);
assert_eq!(
(Item::with_item(&["a"]), Item::with_item(&["b"])),
Item::with_item(&["a", "c"]).ancestry(&Item::with_item(&["a", "b"]))
);
assert_eq!(
(Item::with_item(&["a", "b"]), Item::with_item(&["d", "e"])),
Item::with_item(&["a", "b", "c"]).ancestry(&Item::with_item(&["a", "b", "d", "e"]))
);
} | rust_cleaned_test_functions.jsonl/78652 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
681,
4617,
368,
341,
286,
2060,
10714,
33673,
310,
320,
1234,
486,
931,
1507,
5739,
486,
931,
14702,
310,
5739,
486,
931,
1005,
681,
4617,
2099,
1234,
486,
931,
2398,
286,
3475,
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_atanh() {
assert_eq!(0.0f64.atanh(), 0.0f64);
assert_eq!((-0.0f64).atanh(), -0.0f64);
let inf: f64 = INFINITY;
let neg_inf: f64 = NEG_INFINITY;
let nan: f64 = NAN;
assert_eq!(1.0f64.atanh(), inf);
assert_eq!((-1.0f64).atanh(), neg_inf);
assert!(2f64.atanh().atanh().is_nan());
assert!((-2f64).atanh().atanh().is_nan());
assert!(inf.atanh().is_nan());
assert!(neg_inf.atanh().is_nan());
assert!(nan.atanh().is_nan());
assert_approx_eq!(0.5f64.atanh(), 0.54930614433405484569762261846126285f64);
assert_approx_eq!((-0.5f64).atanh(), -0.54930614433405484569762261846126285f64);
} | rust_cleaned_test_functions.jsonl/7849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 393
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3752,
27924,
368,
341,
286,
2060,
10714,
10297,
15,
13,
15,
69,
21,
19,
6847,
27924,
1507,
220,
15,
13,
15,
69,
21,
19,
317,
286,
2060,
10714,
0,
54934,
15,
13,
15,
69,
21,
19,
568,
16225,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_local_pref_path_attribute() {
let local_pref_bytes: &[u8] = &[0xca, 0x00, 0x00, 0xbe];
let ctx = &ParserContext::new().four_octet_asn(true).nlri_mode(Ipv6);
let result = LocalPrefPathAttribute::from_wire(ctx, local_pref_bytes).unwrap();
assert_eq!(result.1 .0, 3388997822);
let wire = result.1.to_wire(ctx).unwrap();
assert_eq!(wire, local_pref_bytes);
assert_eq!(result.1.wire_len(ctx).unwrap(), wire.len() as u16);
} | rust_cleaned_test_functions.jsonl/49691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
43331,
2638,
16791,
368,
341,
286,
1077,
2205,
43331,
12524,
25,
44590,
84,
23,
60,
284,
44590,
15,
56071,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
42459,
935,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_i32() {
for &i in &[
0,
1,
-1,
2,
-2,
3,
-3,
1234,
i32::max_value(),
i32::max_value() / 2,
123123123,
321312312,
][..]
{
assert_eq!(soft::i32_to_f64(i), (i as f64).to_bits());
assert_eq!(fast::i32_to_f64(i), i as f64);
assert_eq!(soft::i32_to_f32_round(i), (i as f32).to_bits());
assert_eq!(fast::i32_to_f32_round(i), i as f32);
}
} | rust_cleaned_test_functions.jsonl/132320 | {
"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,
5318,
18,
17,
368,
341,
262,
369,
609,
72,
304,
609,
9640,
286,
220,
15,
345,
286,
220,
16,
345,
286,
481,
16,
345,
286,
220,
17,
345,
286,
481,
17,
345,
286,
220,
18,
345,
286,
481,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_find_most_common_bit_in_column(){
let input =
vec![
"00100",
"11110",
"10110",
"10111",
"10101",
"01111",
"00111",
"11100",
"10000",
"11001",
"00010",
"01010",
].iter().map(|&s| s.as_bytes()).collect::<Vec<&[u8]>>();
let result = find_most_common_bit_in_column(&input, 0, '1');
assert_eq!(result, '1');
} | rust_cleaned_test_functions.jsonl/20061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
81416,
21107,
13996,
1243,
8744,
3032,
286,
1077,
1946,
4035,
310,
7486,
90515,
394,
330,
15,
15,
16,
15,
15,
756,
394,
330,
16,
16,
16,
16,
15,
756,
394,
330,
16,
15,
16,
16,
15,
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_extract_arg() {
use super::extract_arg;
use std::collections::HashMap;
let mut cases: HashMap<Vec<String>, Vec<&str>> = HashMap::new();
cases.insert(
vec![String::from("-l"), String::from("16"), String::from("c")],
vec!["-l", "16"],
);
cases.insert(
vec![
String::from("-s"),
String::from("hello-world"),
String::from("c"),
],
vec!["-l", ""],
);
cases.insert(
vec![
String::from("-s"),
String::from("hello-world"),
String::from("c"),
],
vec!["-s", "hello-world"],
);
for case in cases.iter() {
let input = case.0;
let expected = (case.1)[1];
let param = (case.1)[0];
assert_eq!(extract_arg(param, input), expected);
}
} | rust_cleaned_test_functions.jsonl/17123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 561
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
6057,
368,
341,
286,
990,
2256,
486,
23493,
6057,
280,
286,
990,
1460,
486,
51137,
486,
18497,
401,
286,
1077,
5206,
5048,
25,
10528,
50439,
3464,
8066,
11312,
52244,
495,
2452,
284,
10528,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_timestamp_array_from_vec() {
let arr = TimestampSecondArray::from_vec(vec![1, -5], None);
assert_eq!(2, arr.len());
assert_eq!(0, arr.offset());
assert_eq!(0, arr.null_count());
assert_eq!(1, arr.value(0));
assert_eq!(-5, arr.value(1));
assert_eq!(&[1, -5], arr.values());
let arr = TimestampMillisecondArray::from_vec(vec![1, -5], None);
assert_eq!(2, arr.len());
assert_eq!(0, arr.offset());
assert_eq!(0, arr.null_count());
assert_eq!(1, arr.value(0));
assert_eq!(-5, arr.value(1));
assert_eq!(&[1, -5], arr.values());
let arr = TimestampMicrosecondArray::from_vec(vec![1, -5], None);
assert_eq!(2, arr.len());
assert_eq!(0, arr.offset());
assert_eq!(0, arr.null_count());
assert_eq!(1, arr.value(0));
assert_eq!(-5, arr.value(1));
assert_eq!(&[1, -5], arr.values());
let arr = TimestampNanosecondArray::from_vec(vec![1, -5], None);
assert_eq!(2, arr.len());
assert_eq!(0, arr.offset());
assert_eq!(0, arr.null_count());
assert_eq!(1, arr.value(0));
assert_eq!(-5, arr.value(1));
assert_eq!(&[1, -5], arr.values());
} | rust_cleaned_test_functions.jsonl/27281 | {
"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,
23073,
3858,
5673,
13251,
368,
341,
286,
1077,
2890,
284,
32758,
15666,
1857,
486,
1499,
13251,
25592,
20703,
16,
11,
481,
20,
1125,
2240,
317,
286,
2060,
10714,
10297,
17,
11,
2890,
19406,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decimal_builder() {
let mut builder = DecimalBuilder::new(30, 23, 6);
builder.append_value(8_887_000_000).unwrap();
builder.append_null().unwrap();
builder.append_value(-8_887_000_000).unwrap();
let decimal_array: DecimalArray = builder.finish();
assert_eq!(&DataType::Decimal(23, 6), decimal_array.data_type());
assert_eq!(3, decimal_array.len());
assert_eq!(1, decimal_array.null_count());
assert_eq!(20, decimal_array.value_offset(2));
assert_eq!(10, decimal_array.value_length());
} | rust_cleaned_test_functions.jsonl/30992 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74429,
28532,
368,
341,
286,
1077,
5206,
7363,
284,
26728,
3297,
486,
931,
7,
18,
15,
11,
220,
17,
18,
11,
220,
21,
626,
286,
7363,
2057,
3142,
7,
23,
62,
23,
23,
22,
62,
15,
15,
15,
62,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make_mac_ext() {
let key = key();
let ext = "ext-data".to_string();
let mac = Mac::new(
MacType::Header,
&key,
sys_time(1000, 100),
"nonny",
"POST",
"mysite.com",
443,
"/v1/api",
None,
Some(&ext),
)
.unwrap();
println!("got {:?}", mac);
assert!(
mac.0
== vec![
187, 104, 238, 100, 168, 112, 37, 68, 187, 141, 168, 155, 177, 193, 113, 0, 50,
105, 127, 36, 24, 117, 200, 251, 138, 199, 108, 14, 105, 123, 234, 119
]
);
} | rust_cleaned_test_functions.jsonl/52133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 451
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
22802,
9927,
368,
341,
286,
1077,
1376,
284,
1376,
543,
286,
1077,
1303,
284,
330,
427,
13945,
3263,
983,
3904,
543,
286,
1077,
8978,
284,
7401,
486,
931,
1006,
310,
7401,
929,
486,
4047,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let mut adapter = SettingAdapter::new(
SettingType::Account,
Box::new(TestStore::new()),
MutationHandler { process: &process_account_mutation, check_sync: None },
Some(SettingData::Account(AccountSettings { mode: None })),
);
check_login_override(&adapter, None);
let override_update = Some(LoginOverride::AutologinGuest);
adapter.mutate(&Mutation::AccountMutationValue(AccountMutation {
operation: Some(AccountOperation::SetLoginOverride),
login_override: override_update,
}));
check_login_override(&adapter, override_update);
} | rust_cleaned_test_functions.jsonl/21402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
368,
341,
286,
1077,
5206,
12956,
284,
20037,
5940,
486,
931,
1006,
310,
20037,
929,
486,
7365,
345,
310,
8261,
486,
931,
31159,
6093,
486,
931,
14702,
310,
67203,
3050,
314,
1882,
25,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_solicited_fail_4() {
match metadata_solicited(b"METADATA \"\" (/shared/vendor \"asdf\")\r\n") {
Err(_) => {}
_ => panic!("Error required when vendor name is not provided."),
}
} | rust_cleaned_test_functions.jsonl/4872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
91104,
22121,
62,
19,
368,
341,
286,
2432,
11160,
643,
91104,
1883,
1,
44875,
39119,
7245,
2105,
46225,
6100,
35663,
7245,
76615,
62705,
59,
81,
1699,
899,
341,
310,
15495,
48139,
589,
5613,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_users_by_query() {
let beam = Beam::new();
let res = beam.users.get_users_by_query(String::from(QUERY), 0);
assert!(res.is_ok());
} | rust_cleaned_test_functions.jsonl/90016 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16348,
3710,
5738,
368,
341,
262,
1077,
23418,
284,
50130,
486,
931,
543,
262,
1077,
592,
284,
23418,
20653,
670,
16348,
3710,
5738,
2242,
486,
1499,
7,
41019,
701,
220,
15,
317,
262,
2060,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_create_datetime_frac_from_int() {
assert_eq!(Value::DateTime(DateTime::new(Date::new_str("2012", "01", "03"), Some(Time::new_str(
"03", "30", "30", Some("3030"), None
)))), Value::datetime_frac_from_int(2012, 1, 3, 3, 30, 30, 3030).unwrap());
} | rust_cleaned_test_functions.jsonl/86213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
28943,
70358,
5673,
4042,
368,
341,
262,
2060,
10714,
10297,
1130,
486,
7689,
32083,
486,
931,
19987,
486,
931,
2895,
445,
17,
15,
16,
17,
497,
330,
15,
16,
497,
330,
15,
18,
3975,
4329,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_row_group_metadata_thrift_conversion_empty() {
let schema_descr = get_test_schema_descr();
let row_group_meta = RowGroupMetaData::builder(schema_descr).build();
assert!(row_group_meta.is_err());
if let Err(e) = row_group_meta {
assert_eq!(
format!("{}", e),
"Parquet error: Column length mismatch: 2 != 0"
);
}
} | rust_cleaned_test_functions.jsonl/82558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
6288,
22220,
5854,
41380,
64132,
15124,
368,
341,
286,
1077,
10802,
64622,
284,
633,
4452,
25371,
64622,
1428,
286,
1077,
2802,
6288,
13381,
284,
10801,
2808,
37307,
486,
17850,
42735,
64622,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_kvm_api_version() {
let kvm = Kvm::new().unwrap();
assert_eq!(kvm.get_api_version(), 12);
assert!(kvm.check_extension(Cap::UserMemory));
} | rust_cleaned_test_functions.jsonl/127384 | {
"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,
4698,
7338,
11697,
9438,
368,
341,
286,
1077,
94748,
284,
730,
7338,
486,
931,
1005,
15454,
543,
286,
2060,
10714,
10297,
74,
7338,
670,
11697,
9438,
1507,
220,
16,
17,
317,
286,
2060,
10297,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_shrink_vectors() {
const PACKET_COUNT: usize = 1024;
const BATCH_COUNT: usize = PACKET_COUNT / PACKETS_PER_BATCH;
let set_discards = [
// contiguous
// No discards
|_, _| false,
// All discards
|_, _| true,
// single partitions
// discard last half of packets
|b, p| ((b * PACKETS_PER_BATCH) + p) >= (PACKET_COUNT / 2),
// discard first half of packets
|b, p| ((b * PACKETS_PER_BATCH) + p) < (PACKET_COUNT / 2),
// discard last half of each batch
|_, p| p >= (PACKETS_PER_BATCH / 2),
// discard first half of each batch
|_, p| p < (PACKETS_PER_BATCH / 2),
// uniform sparse
// discard even packets
|b, p| ((b * PACKETS_PER_BATCH) + p) % 2 == 0,
// discard odd packets
|b, p| ((b * PACKETS_PER_BATCH) + p) % 2 == 1,
// discard even batches
|b, _| b % 2 == 0,
// discard odd batches
|b, _| b % 2 == 1,
// edges
// discard first batch
|b, _| b == 0,
// discard last batch
|b, _| b == BATCH_COUNT - 1,
// discard first and last batches
|b, _| b == 0 || b == BATCH_COUNT - 1,
// discard all but first and last batches
|b, _| b != 0 && b != BATCH_COUNT - 1,
// discard first packet
|b, p| ((b * PACKETS_PER_BATCH) + p) == 0,
// discard all but first packet
|b, p| ((b * PACKETS_PER_BATCH) + p) != 0,
// discard last packet
|b, p| ((b * PACKETS_PER_BATCH) + p) == PACKET_COUNT - 1,
// discard all but last packet
|b, p| ((b * PACKETS_PER_BATCH) + p) != PACKET_COUNT - 1,
// discard first packet of each batch
|_, p| p == 0,
// discard all but first packet of each batch
|_, p| p != 0,
// discard last packet of each batch
|_, p| p == PACKETS_PER_BATCH - 1,
// discard all but last packet of each batch
|_, p| p != PACKETS_PER_BATCH - 1,
// discard first and last packet of each batch
|_, p| p == 0 || p == PACKETS_PER_BATCH - 1,
// discard all but first and last packet of each batch
|_, p| p != 0 && p != PACKETS_PER_BATCH - 1,
// discard all after first packet in second to last batch
|b, p| (b == BATCH_COUNT - 2 && p > 0) || b == BATCH_COUNT - 1,
];
let expect_valids = [
// contiguous
(BATCH_COUNT, PACKET_COUNT),
(0, 0),
// single partitions
(BATCH_COUNT / 2, PACKET_COUNT / 2),
(BATCH_COUNT / 2, PACKET_COUNT / 2),
(BATCH_COUNT / 2, PACKET_COUNT / 2),
(BATCH_COUNT / 2, PACKET_COUNT / 2),
// uniform sparse
(BATCH_COUNT / 2, PACKET_COUNT / 2),
(BATCH_COUNT / 2, PACKET_COUNT / 2),
(BATCH_COUNT / 2, PACKET_COUNT / 2),
(BATCH_COUNT / 2, PACKET_COUNT / 2),
// edges
(BATCH_COUNT - 1, PACKET_COUNT - PACKETS_PER_BATCH),
(BATCH_COUNT - 1, PACKET_COUNT - PACKETS_PER_BATCH),
(BATCH_COUNT - 2, PACKET_COUNT - 2 * PACKETS_PER_BATCH),
(2, 2 * PACKETS_PER_BATCH),
(BATCH_COUNT, PACKET_COUNT - 1),
(1, 1),
(BATCH_COUNT, PACKET_COUNT - 1),
(1, 1),
(
(BATCH_COUNT * (PACKETS_PER_BATCH - 1) + PACKETS_PER_BATCH) / PACKETS_PER_BATCH,
(PACKETS_PER_BATCH - 1) * BATCH_COUNT,
),
(
(BATCH_COUNT + PACKETS_PER_BATCH) / PACKETS_PER_BATCH,
BATCH_COUNT,
),
(
(BATCH_COUNT * (PACKETS_PER_BATCH - 1) + PACKETS_PER_BATCH) / PACKETS_PER_BATCH,
(PACKETS_PER_BATCH - 1) * BATCH_COUNT,
),
(
(BATCH_COUNT + PACKETS_PER_BATCH) / PACKETS_PER_BATCH,
BATCH_COUNT,
),
(
(BATCH_COUNT * (PACKETS_PER_BATCH - 2) + PACKETS_PER_BATCH) / PACKETS_PER_BATCH,
(PACKETS_PER_BATCH - 2) * BATCH_COUNT,
),
(
(2 * BATCH_COUNT + PACKETS_PER_BATCH) / PACKETS_PER_BATCH,
PACKET_COUNT - (PACKETS_PER_BATCH - 2) * BATCH_COUNT,
),
(BATCH_COUNT - 1, PACKET_COUNT - 2 * PACKETS_PER_BATCH + 1),
];
let test_cases = set_discards.iter().zip(&expect_valids).enumerate();
for (i, (set_discard, (expect_batch_count, expect_valid_packets))) in test_cases {
println!("test_shrink case: {}", i);
let mut batches = to_packet_batches(
&(0..PACKET_COUNT).map(|_| test_tx()).collect::<Vec<_>>(),
PACKETS_PER_BATCH,
);
assert_eq!(batches.len(), BATCH_COUNT);
assert_eq!(count_valid_packets(&batches), PACKET_COUNT);
batches.iter_mut().enumerate().for_each(|(i, b)| {
b.packets
.iter_mut()
.enumerate()
.for_each(|(j, p)| p.meta.set_discard(set_discard(i, j)))
});
assert_eq!(count_valid_packets(&batches), *expect_valid_packets);
println!("show valid packets for case {}", i);
batches.iter_mut().enumerate().for_each(|(i, b)| {
b.packets.iter_mut().enumerate().for_each(|(j, p)| {
if !p.meta.discard() {
println!("{} {}", i, j)
}
})
});
println!("done show valid packets for case {}", i);
let shrunken_batch_count = shrink_batches(&mut batches);
println!("shrunk batch test {} count: {}", i, shrunken_batch_count);
assert_eq!(shrunken_batch_count, *expect_batch_count);
batches.truncate(shrunken_batch_count);
assert_eq!(count_valid_packets(&batches), *expect_valid_packets);
}
} | rust_cleaned_test_functions.jsonl/22101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3675
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
34365,
49158,
368,
341,
286,
733,
73205,
14672,
25,
22301,
284,
220,
16,
15,
17,
19,
280,
286,
733,
98791,
14672,
25,
22301,
284,
73205,
14672,
608,
33332,
43167,
10617,
74009,
401,
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... | 9 |
#[test]
fn test_serialization() {
let data = TestData {
score: vec![
("a_guy".to_owned(), 200),
("b_guy".to_owned(), 300),
("c_guy".to_owned(), 400),
],
};
let serialized = serde_json::to_value(data).expect("expected data to serialize successfully");
assert_eq!(
serialized,
json!({
"score": {
"a_guy": 200,
"b_guy": 300,
"c_guy": 400,
}
})
);
} | rust_cleaned_test_functions.jsonl/95161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25602,
2022,
368,
341,
262,
1077,
821,
284,
93200,
341,
286,
5456,
25,
7486,
90515,
310,
3489,
64,
1889,
4076,
3263,
983,
51973,
1507,
220,
17,
15,
15,
1326,
310,
3489,
65,
1889,
4076,
3263,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_addrs() {
let table = vec![
("127.0.0.1:8080", true),
("[::1]:8080", true),
("localhost:8080", true),
("pingcap.com:8080", true),
("funnydomain:8080", true),
("127.0.0.1", false),
("[::1]", false),
("localhost", false),
("pingcap.com", false),
("funnydomain", false),
("funnydomain:", false),
("root@google.com:8080", false),
("http://google.com:8080", false),
("google.com:8080/path", false),
("http://google.com:8080/path", false),
("http://google.com:8080/path?lang=en", false),
("http://google.com:8080/path?lang=en#top", false),
("ftp://ftp.is.co.za/rfc/rfc1808.txt", false),
("http://www.ietf.org/rfc/rfc2396.txt", false),
("ldap://[2001:db8::7]/c=GB?objectClass?one", false),
("mailto:John.Doe@example.com", false),
("news:comp.infosystems.www.servers.unix", false),
("tel:+1-816-555-1212", false),
("telnet://192.0.2.16:80/", false),
("urn:oasis:names:specification:docbook:dtd:xml:4.1.2", false),
(":8080", false),
("8080", false),
("8080:", false),
];
for (addr, is_ok) in table {
assert_eq!(check_addr(addr).is_ok(), is_ok);
}
let table = vec![
("0.0.0.0:8080", true),
("[::0]:8080", true),
("127.0.0.1:8080", false),
("[::1]:8080", false),
("localhost:8080", false),
("pingcap.com:8080", false),
("funnydomain:8080", false),
];
for (addr, is_unspecified) in table {
assert_eq!(check_addr(addr).unwrap(), is_unspecified);
}
} | rust_cleaned_test_functions.jsonl/1558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1061
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
2891,
5428,
368,
341,
286,
1077,
1965,
284,
7486,
90515,
310,
3489,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
23,
15,
23,
15,
497,
830,
1326,
310,
3489,
58,
486,
16,
5669,
23,
15,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_meta_doc_comments_non_latin() {
check(
r#"
macro_rules! m {
($(#[$ m:meta])+) => ( $(#[$m])+ fn bar() {} )
}
m! {
/// 錦瑟無端五十弦,一弦一柱思華年。
/**
莊生曉夢迷蝴蝶,望帝春心託杜鵑。
*/
}
"#,
expect![[r##"
macro_rules! m {
($(#[$ m:meta])+) => ( $(#[$m])+ fn bar() {} )
}
#[doc = " 錦瑟無端五十弦,一弦一柱思華年。"]
#[doc = "\n 莊生曉夢迷蝴蝶,望帝春心託杜鵑。\n "] fn bar() {}
"##]],
);
} | rust_cleaned_test_functions.jsonl/85237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13381,
18869,
30359,
21637,
907,
14768,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
341,
262,
1711,
32735,
3442,
296,
25,
5490,
2467,
36197,
589,
320,
4930,
2,
3442,
76,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rrot() {
use ark_std::vec::Vec;
let numbers = (0..100u64).collect::<Vec<_>>();
let right_rotation = RightRotationStreamer(&numbers.as_slice(), &1)
.iter()
.cloned()
.collect::<Vec<_>>();
assert_eq!(right_rotation[0], 0);
assert_eq!(right_rotation[1], 1);
assert_eq!(right_rotation[99], 99);
assert_eq!(right_rotation[100], 1);
} | rust_cleaned_test_functions.jsonl/107463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
4640,
368,
341,
262,
990,
55217,
15656,
486,
4083,
486,
10050,
401,
262,
1077,
5109,
284,
320,
15,
496,
16,
15,
15,
84,
21,
19,
568,
17384,
27638,
10050,
32399,
37038,
262,
1077,
1290,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode() {
assert_eq!(base62::encode(u128::MAX), "7n42DGM5Tflk9n8mt7Fhc7");
assert_eq!(base62::encode(0u8), "0");
} | rust_cleaned_test_functions.jsonl/50827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
368,
341,
286,
2060,
10714,
10297,
3152,
21,
17,
486,
6180,
8154,
16,
17,
23,
486,
10586,
701,
330,
22,
77,
19,
17,
35,
20637,
20,
51,
1489,
74,
24,
77,
23,
2501,
22,
37,
38052,
22,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inplace_repeat() {
let gil = Python::acquire_gil();
let py = gil.python();
let d = [("ByteSequence", py.get_type::<ByteSequence>())].into_py_dict(py);
py_run!(
py,
*d,
"s = ByteSequence([1, 2]); s *= 3; assert list(s) == [1, 2, 1, 2, 1, 2]"
);
py_expect_exception!(py, *d, "s = ByteSequence([1, 2]); s *= -1", PyValueError);
} | rust_cleaned_test_functions.jsonl/46920 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
2007,
41975,
368,
341,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
1428,
262,
1077,
294,
284,
84019,
7153,
14076,
497,
4510,
670,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_iter_leak() {
static mut DROPS: i32 = 0;
struct D(bool);
impl Drop for D {
fn drop(&mut self) {
unsafe {
DROPS += 1;
}
if self.0 {
panic!("panic in `drop`");
}
}
}
let v = vec![D(false), D(true), D(false)];
catch_unwind(move || drop(v.into_iter())).ok();
assert_eq!(unsafe { DROPS }, 3);
} | rust_cleaned_test_functions.jsonl/24443 | {
"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,
45514,
11723,
11751,
585,
368,
341,
262,
1099,
5206,
422,
1285,
5012,
25,
600,
18,
17,
284,
220,
15,
401,
262,
2036,
422,
9764,
626,
262,
11605,
15733,
369,
422,
341,
286,
5168,
5943,
2099,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reader_writer_ring() {
let mut buf = [0u8; 16];
let ring = Ring::new(&mut buf);
let r = ring.reader();
let w = ring.writer();
for _ in 0..16 {
assert_eq!(w.write(&[0, 1, 2, 3]), 4);
let mut dst = [0u8; 4];
assert_eq!(r.read(&mut dst), 4);
assert_eq!(dst, [0, 1, 2, 3])
}
assert_eq!(ring.head(), 16 * 4);
assert_eq!(ring.tail(), 16 * 4);
} | rust_cleaned_test_functions.jsonl/114710 | {
"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,
22306,
28908,
34683,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
84,
23,
26,
220,
16,
21,
935,
286,
1077,
10058,
284,
21525,
486,
931,
2099,
6984,
6607,
317,
286,
1077,
435,
284,
10058,
347... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_json_escape_standard() {
let input = "\r\n\t\\";
let mut into = String::new();
escape_json(input, &mut into);
assert_eq!(into, "\\r\\n\\t\\\\");
} | rust_cleaned_test_functions.jsonl/67936 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
21832,
48688,
368,
341,
286,
1077,
1946,
284,
2917,
81,
1699,
4955,
3422,
876,
286,
1077,
5206,
1119,
284,
923,
486,
931,
1428,
286,
12449,
9455,
5384,
11,
609,
6984,
1119,
626,
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 |
#[test]
fn test_apply_brute_force() {
let _num_qubits = 2;
let mut circuit = Circuit::new(_num_qubits, Some("brute_force".to_string()));
circuit.add_hadamard_gate(0);
circuit.add_hadamard_gate(1);
circuit.add_cnot_gate(0, 1);
circuit.forward();
let expected_local_amplitudes = array![
Complex::<f64> {
re: 1. / 2.,
im: 0.
},
Complex::<f64> {
re: 1. / 2.,
im: 0.
},
Complex::<f64> {
re: 1. / 2.,
im: 0.
},
Complex::<f64> {
re: 1. / 2.,
im: 0.
}
];
for (item, expected) in circuit
.local_amplitudes
.iter()
.zip(&expected_local_amplitudes)
{
let diff = item - expected;
assert!(diff.norm() < 0.01);
}
} | rust_cleaned_test_functions.jsonl/104575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 621
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
17682,
1070,
40739,
368,
341,
286,
1077,
716,
2413,
8976,
81402,
284,
220,
17,
280,
286,
1077,
5206,
16224,
284,
27218,
486,
931,
2490,
2413,
8976,
81402,
11,
4329,
445,
1323,
1070,
40739,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_modexp() {
let input = &hex_decode(
"0000000000000000000000000000000000000000000000000000000000000001\
0000000000000000000000000000000000000000000000000000000000000001\
0000000000000000000000000000000000000000000000000000000000000001\
03\
05\
07",
)
.unwrap();
let output = vec![5u8];
test_precompile!(ModExp, input, output, 200);
let input = &hex_decode(
"0000000000000000000000000000000000000000000000000000000000000020\
0000000000000000000000000000000000000000000000000000000000000020\
0000000000000000000000000000000000000000000000000000000000000020\
000000000000000000000000000000000000000000000000000000000000EA5F\
0000000000000000000000000000000000000000000000000000000000000015\
0000000000000000000000000000000000000000000000000000000000003874",
)
.unwrap();
let mut output = vec![0u8; 32];
U256::from(10055).to_big_endian(&mut output);
test_precompile!(ModExp, input, output, 200);
let input = &hex_decode(
"0000000000000000000000000000000000000000000000000000000000000001\
0000000000000000000000000000000000000000000000000000000000000020\
0000000000000000000000000000000000000000000000000000000000000020\
03\
fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e\
fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
)
.unwrap();
let mut output = vec![0u8; 32];
U256::from(1).to_big_endian(&mut output);
test_precompile!(ModExp, input, output, 1360);
} | rust_cleaned_test_functions.jsonl/51966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
4580,
368,
341,
262,
1077,
1946,
284,
609,
17308,
15227,
1006,
286,
330,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_table_get() {
let (src, size) = build_table(build_data());
let table = Table::new(Options::default(), wrap_buffer(src), size).unwrap();
let table2 = table.clone();
let mut _iter = table.iter();
for (k, v) in SSIteratorIter::wrap(&mut _iter) {
let r = table2.get(&k);
assert_eq!(Ok(Some(v)), r);
}
assert_eq!(
table.opt.block_cache.read().expect(LOCK_POISONED).count(),
3
);
// test that filters work and don't return anything at all.
assert!(table.get(b"aaa").unwrap().is_none());
assert!(table.get(b"aaaa").unwrap().is_none());
assert!(table.get(b"aa").unwrap().is_none());
assert!(table.get(b"abcd").unwrap().is_none());
assert!(table.get(b"abb").unwrap().is_none());
assert!(table.get(b"xyy").unwrap().is_none());
assert!(table.get(b"zzy").unwrap().is_none());
assert!(table.get(b"zz1").unwrap().is_none());
assert!(table.get("zz{".as_bytes()).unwrap().is_none());
} | rust_cleaned_test_functions.jsonl/3809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5237,
3062,
368,
341,
286,
1077,
320,
3548,
11,
1379,
8,
284,
1936,
5237,
43333,
1769,
5231,
286,
1077,
1965,
284,
6633,
486,
931,
7,
3798,
486,
2258,
1507,
15061,
7776,
14705,
701,
1379,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_tseitin_or() {
use cryptominisat::Lbool;
let mut solver = Solver::new();
let (r, x, y) = (solver.new_var(), solver.new_var(), solver.new_var());
// Let r = x | y
add_tseitin_or(&mut solver, r, x, y);
// The constraint set is feasible.
assert_eq!(solver.solve(), Lbool::True);
// Iterate over the truth value for all 3 variables
for values in 0..8 {
let r_value = (values & 1) != 0;
let x_value = (values & 2) != 0;
let y_value = (values & 4) != 0;
let assumptions = [
Lit::new(r.var(), !r_value).expect("ok"),
Lit::new(x.var(), !x_value).expect("ok"),
Lit::new(y.var(), !y_value).expect("ok"),
];
// Should be true if `values != 7`
let expected = if r_value == (x_value | y_value) {
Lbool::True
} else {
Lbool::False
};
println!(
"values={} assumptions={:?} expected={:?}",
values, assumptions, expected
);
assert_eq!(solver.solve_with_assumptions(&assumptions), expected);
}
} | rust_cleaned_test_functions.jsonl/97533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 547
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
325,
84886,
8734,
368,
341,
262,
990,
14436,
7970,
285,
266,
486,
43,
2641,
401,
262,
1077,
5206,
28961,
284,
68295,
486,
931,
543,
262,
1077,
320,
81,
11,
856,
11,
379,
8,
284,
320,
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... | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.