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_aggregator_plan() -> anyhow::Result<()> {
let source = Test::create().generate_source_plan_for_test(10000)?;
let plan = PlanBuilder::from(&source)
.aggregate_partial(&[sum(col("number")).alias("sumx")], &[])?
.aggregate_final(source.schema(), &[sum(col("number")).alias("sumx")], &[])?
.project(&[col("sumx")])?
.build()?;
let explain = PlanNode::Explain(ExplainPlan {
typ: ExplainType::Syntax,
input: Arc::new(plan),
});
let expect = "\
Projection: sumx:UInt64\
\n AggregatorFinal: groupBy=[[]], aggr=[[sum(number) as sumx]]\
\n AggregatorPartial: groupBy=[[]], aggr=[[sum(number) as sumx]]\
\n ReadDataSource: scan partitions: [8], scan schema: [number:UInt64], statistics: [read_rows: 10000, read_bytes: 80000]";
let actual = format!("{:?}", explain);
assert_eq!(expect, actual);
Ok(())
} | rust_cleaned_test_functions.jsonl/104496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20587,
58131,
26564,
368,
1464,
88964,
486,
2077,
71698,
341,
262,
1077,
2530,
284,
3393,
486,
3182,
1005,
19366,
10347,
26564,
5478,
4452,
7,
16,
15,
15,
15,
15,
40007,
262,
1077,
3119,
284,
96... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_getters() {
let mut config = Config::new();
assert!(config.commands().is_empty());
assert!(config.commands_mut().is_empty());
assert!(config.prefixes().is_empty());
assert!(config.prefixes_mut().is_empty());
} | rust_cleaned_test_functions.jsonl/123098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5045,
368,
341,
286,
1077,
5206,
2193,
284,
5532,
486,
931,
543,
286,
2060,
10297,
1676,
33902,
1005,
285,
15124,
1423,
286,
2060,
10297,
1676,
33902,
29523,
1005,
285,
15124,
1423,
286,
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 |
#[test]
fn test_pretty_format_fixed_size_binary() -> Result<()> {
// define a schema.
let field_type = DataType::FixedSizeBinary(3);
let schema = Arc::new(Schema::new(vec![Field::new("d1", field_type, true)]));
let mut builder = FixedSizeBinaryBuilder::new(3, 3);
builder.append_value(&[1, 2, 3]).unwrap();
builder.append_null().unwrap();
builder.append_value(&[7, 8, 9]).unwrap();
let array = Arc::new(builder.finish());
let batch = RecordBatch::try_new(schema, vec![array])?;
let table = pretty_format_batches(&[batch])?.to_string();
let expected = vec![
"+--------+",
"| d1 |",
"+--------+",
"| 010203 |",
"| |",
"| 070809 |",
"+--------+",
];
let actual: Vec<&str> = table.lines().collect();
assert_eq!(expected, actual, "Actual result:\n{}", table);
Ok(())
} | rust_cleaned_test_functions.jsonl/5240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
21322,
8955,
37839,
2368,
31761,
368,
1464,
5714,
71698,
341,
286,
442,
6979,
264,
10802,
624,
286,
1077,
2070,
1819,
284,
33172,
486,
73174,
21338,
7,
18,
317,
286,
1077,
10802,
284,
19689,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_globals() {
#[llvm_versions(7.0..=latest)]
use self::inkwell::values::UnnamedAddress;
let context = Context::create();
let module = context.create_module("my_mod");
let i8_type = context.i8_type();
let i8_zero = i8_type.const_int(0, false);
assert!(module.get_first_global().is_none());
assert!(module.get_last_global().is_none());
assert!(module.get_global("my_global").is_none());
let global = module.add_global(i8_type, None, "my_global");
#[cfg(not(any(feature = "llvm3-6", feature = "llvm3-7", feature = "llvm3-8", feature = "llvm3-9",
feature = "llvm4-0", feature = "llvm5-0", feature = "llvm6-0")))]
assert_eq!(global.get_unnamed_address(), UnnamedAddress::None);
assert!(global.get_previous_global().is_none());
assert!(global.get_next_global().is_none());
assert!(global.get_initializer().is_none());
assert!(!global.is_thread_local());
assert!(global.get_thread_local_mode().is_none());
assert!(!global.is_constant());
assert!(global.is_declaration());
assert!(!global.has_unnamed_addr());
assert!(!global.is_externally_initialized());
#[cfg(not(any(feature = "llvm4-0", feature = "llvm5-0", feature = "llvm6-0", feature = "llvm7-0", feature = "llvm8-0")))]
assert_eq!(global.get_section(), &*CString::new("").unwrap());
assert_eq!(global.get_dll_storage_class(), DLLStorageClass::default());
assert_eq!(global.get_visibility(), GlobalVisibility::default());
assert_eq!(global.get_linkage(), External);
assert_eq!(module.get_first_global().unwrap(), global);
assert_eq!(module.get_last_global().unwrap(), global);
assert_eq!(module.get_global("my_global").unwrap(), global);
#[cfg(not(any(feature = "llvm3-6", feature = "llvm3-7", feature = "llvm3-8", feature = "llvm3-9",
feature = "llvm4-0", feature = "llvm5-0", feature = "llvm6-0")))]
global.set_unnamed_address(UnnamedAddress::Local);
global.set_dll_storage_class(DLLStorageClass::Import);
global.set_initializer(&i8_zero);
global.set_thread_local_mode(Some(ThreadLocalMode::InitialExecTLSModel));
global.set_unnamed_addr(true);
global.set_constant(true);
global.set_visibility(GlobalVisibility::Hidden);
global.set_section("not sure what goes here");
// REVIEW: Not sure why this is Global when we set it to Local
#[cfg(not(any(feature = "llvm3-6", feature = "llvm3-7", feature = "llvm3-8", feature = "llvm3-9",
feature = "llvm4-0", feature = "llvm5-0", feature = "llvm6-0")))]
assert_eq!(global.get_unnamed_address(), UnnamedAddress::Global);
assert_eq!(global.get_dll_storage_class(), DLLStorageClass::Import);
assert_eq!(global.get_initializer().unwrap().into_int_value(), i8_zero);
assert_eq!(global.get_visibility(), GlobalVisibility::Hidden);
assert_eq!(global.get_thread_local_mode().unwrap(), ThreadLocalMode::InitialExecTLSModel);
assert!(global.is_thread_local());
assert!(global.has_unnamed_addr());
assert!(global.is_constant());
assert!(!global.is_declaration());
assert_eq!(global.get_section(), &*CString::new("not sure what goes here").unwrap());
// Either linkage is non-local or visibility is default.
global.set_visibility(GlobalVisibility::Default);
global.set_linkage(Private);
assert_eq!(global.get_linkage(), Private);
#[cfg(not(any(feature = "llvm3-6", feature = "llvm3-7", feature = "llvm3-8", feature = "llvm3-9",
feature = "llvm4-0", feature = "llvm5-0", feature = "llvm6-0")))]
global.set_unnamed_address(UnnamedAddress::Global);
global.set_dll_storage_class(DLLStorageClass::Export);
global.set_thread_local(false);
global.set_linkage(External);
global.set_visibility(GlobalVisibility::Protected);
#[cfg(not(any(feature = "llvm3-6", feature = "llvm3-7", feature = "llvm3-8", feature = "llvm3-9",
feature = "llvm4-0", feature = "llvm5-0", feature = "llvm6-0")))]
assert_eq!(global.get_unnamed_address(), UnnamedAddress::Global);
assert!(!global.is_thread_local());
assert_eq!(global.get_visibility(), GlobalVisibility::Protected);
global.set_thread_local(true);
assert_eq!(global.get_dll_storage_class(), DLLStorageClass::Export);
assert!(global.is_thread_local());
assert_eq!(global.get_thread_local_mode().unwrap(), ThreadLocalMode::GeneralDynamicTLSModel);
global.set_thread_local_mode(Some(ThreadLocalMode::LocalExecTLSModel));
assert_eq!(global.get_thread_local_mode().unwrap(), ThreadLocalMode::LocalExecTLSModel);
global.set_thread_local_mode(Some(ThreadLocalMode::LocalDynamicTLSModel));
assert_eq!(global.get_thread_local_mode().unwrap(), ThreadLocalMode::LocalDynamicTLSModel);
global.set_thread_local_mode(None);
assert!(global.get_thread_local_mode().is_none());
let global2 = module.add_global(i8_type, Some(AddressSpace::Const), "my_global2");
assert_eq!(global2.get_previous_global().unwrap(), global);
assert_eq!(global.get_next_global().unwrap(), global2);
assert_eq!(module.get_first_global().unwrap(), global);
assert_eq!(module.get_last_global().unwrap(), global2);
assert_eq!(module.get_global("my_global2").unwrap(), global2);
assert!(!global.is_declaration());
assert!(!global.is_externally_initialized());
assert_eq!(global.get_alignment(), 0);
global.set_alignment(4);
assert_eq!(global.get_alignment(), 4);
global2.set_externally_initialized(true);
// REVIEW: This doesn't seem to work. LLVM bug?
assert!(global2.is_externally_initialized());
#[cfg(not(any(feature = "llvm3-6", feature = "llvm3-7", feature = "llvm3-8", feature = "llvm3-9",
feature = "llvm4-0", feature = "llvm5-0", feature = "llvm6-0")))]
{
assert!(global.get_comdat().is_none());
let comdat = module.get_or_insert_comdat("my_comdat");
assert!(global.get_comdat().is_none());
global.set_comdat(comdat);
assert_eq!(comdat, global.get_comdat().unwrap());
assert_eq!(comdat.get_selection_kind(), ComdatSelectionKind::Any);
comdat.set_selection_kind(ComdatSelectionKind::Largest);
assert_eq!(comdat.get_selection_kind(), ComdatSelectionKind::Largest);
}
unsafe {
global.delete();
}
} | rust_cleaned_test_functions.jsonl/122310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2536
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58775,
368,
341,
262,
11506,
29042,
65148,
7,
22,
13,
15,
496,
28,
19350,
5563,
262,
990,
656,
486,
766,
9157,
486,
3661,
486,
78925,
4286,
401,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checksum_omitted() {
let packet = Packet::new_unchecked(&NO_CHECKSUM_PACKET[..]);
let repr = Repr::parse(&packet, &SRC_ADDR.into(), &DST_ADDR.into(),
&ChecksumCapabilities::default()).unwrap();
assert_eq!(repr, packet_repr());
} | rust_cleaned_test_functions.jsonl/36421 | {
"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,
64038,
62,
316,
3762,
368,
341,
286,
1077,
10151,
284,
28889,
486,
931,
4907,
7549,
2099,
8996,
11780,
27377,
40328,
95874,
2558,
286,
1077,
30636,
284,
1032,
649,
486,
6400,
2099,
24829,
11,
609,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_u32() {
let v = Value::UInt32(32);
let u: u32 = u32::from(v);
assert_eq!(u, 32);
} | rust_cleaned_test_functions.jsonl/114568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
7300,
18,
17,
368,
341,
286,
1077,
348,
284,
5162,
486,
18777,
18,
17,
7,
18,
17,
317,
286,
1077,
575,
25,
575,
18,
17,
284,
575,
18,
17,
486,
1499,
3747,
317,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_syn_received_no_window_scaling() {
let mut s = socket_listen();
send!(s, TcpRepr {
control: TcpControl::Syn,
seq_number: REMOTE_SEQ,
ack_number: None,
..SEND_TEMPL
});
assert_eq!(s.state(), State::SynReceived);
assert_eq!(s.local_endpoint(), LOCAL_END);
assert_eq!(s.remote_endpoint(), REMOTE_END);
recv!(s, [TcpRepr {
control: TcpControl::Syn,
seq_number: LOCAL_SEQ,
ack_number: Some(REMOTE_SEQ + 1),
max_seg_size: Some(BASE_MSS),
window_scale: None,
..RECV_TEMPL
}]);
send!(s, TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
window_scale: None,
..SEND_TEMPL
});
assert_eq!(s.remote_win_scale, None);
} | rust_cleaned_test_functions.jsonl/91819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 529
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51393,
40783,
6536,
12571,
79216,
368,
341,
286,
1077,
5206,
274,
284,
7575,
79286,
543,
286,
3624,
10297,
82,
11,
64876,
693,
649,
341,
310,
2524,
25,
64876,
3273,
486,
37134,
345,
310,
12981,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_has_waiter() {
let mut lock_mgr = LockManager::new();
lock_mgr
.start_waiter_manager(&Config::default())
.expect("could not start waiter manager");
assert!(!lock_mgr.has_waiter());
let (lock_ts, hash) = (10.into(), 1);
lock_mgr.wait_for(
20.into(),
StorageCallback::Boolean(Box::new(|_| ())),
ProcessResult::Res,
Lock { ts: lock_ts, hash },
true,
0,
);
// new waiters should be sensed immediately
assert!(lock_mgr.has_waiter());
lock_mgr.wake_up(lock_ts, Some(vec![hash]), 15.into(), false);
thread::sleep(Duration::from_secs(1));
assert!(!lock_mgr.has_waiter());
lock_mgr.stop_waiter_manager();
} | rust_cleaned_test_functions.jsonl/81052 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21778,
18760,
261,
368,
341,
286,
1077,
5206,
5296,
42438,
284,
15701,
2043,
486,
931,
543,
286,
5296,
42438,
198,
310,
659,
2468,
18760,
261,
12144,
2099,
2648,
486,
2258,
2398,
310,
659,
17119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_date_parsers() {
assert_eq!(any_date_format("MMM23"), Ok(("23", FormatPiece::MonthName)));
assert_eq!(any_date_format("DD23"), Ok(("23", FormatPiece::Day)));
assert_eq!(
any_date_format("sss23"),
Ok(("23", FormatPiece::AbsoluteMilliseconds))
);
assert_eq!(any_date_format("MM23"), Ok(("23", FormatPiece::Month)));
assert_eq!(any_date_format("DDMM"), Ok(("MM", FormatPiece::Day)));
assert_eq!(any_date_format("YYYY-"), Ok(("-", FormatPiece::Year)));
assert_eq!(any_date_format("yy-"), Ok(("-", FormatPiece::YearShort)));
assert_eq!(
any_date_format("-YYYY"),
Ok(("YYYY", FormatPiece::SeperatorChar('-')))
);
} | rust_cleaned_test_functions.jsonl/75223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
620,
40488,
368,
341,
286,
2060,
10714,
10297,
3767,
4164,
8955,
445,
86673,
17,
18,
3975,
7622,
30873,
17,
18,
497,
15042,
31209,
486,
11318,
675,
4945,
286,
2060,
10714,
10297,
3767,
4164,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_program_is_native_loader() {
let (genesis_config, mint_keypair) = create_genesis_config(50000);
let bank = Bank::new(&genesis_config);
let tx = Transaction::new_signed_with_payer(
&[Instruction::new_with_bincode(
native_loader::id(),
&(),
vec![],
)],
Some(&mint_keypair.pubkey()),
&[&mint_keypair],
bank.last_blockhash(),
);
assert_eq!(
bank.process_transaction(&tx),
Err(TransactionError::InstructionError(
0,
InstructionError::UnsupportedProgramId
))
);
} | rust_cleaned_test_functions.jsonl/2663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
6892,
44494,
22139,
368,
341,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
15,
15,
317,
286,
1077,
6073,
284,
8547,
486,
931,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_midi_map() {
let gc = audio_garbage_collector::GarbageCollector::default();
let store = SharedCell::new(Shared::new(gc.handle(), Default::default()));
let midi_map = MidiMap::new(gc.handle(), store);
assert!(midi_map.is_empty());
} | rust_cleaned_test_functions.jsonl/36324 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
717,
12278,
5376,
368,
341,
286,
1077,
22122,
284,
7699,
1889,
277,
20652,
10211,
27669,
486,
43930,
20652,
53694,
486,
2258,
543,
286,
1077,
3553,
284,
16990,
3599,
486,
931,
7,
16997,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_number() {
assert_eq!(parse_number("-3.14e-4").unwrap(), Number::Float(-0.000_314));
assert_eq!(parse_number("0").unwrap(), Number::Integer(0));
assert_eq!(parse_number("124").unwrap(), Number::Integer(124));
} | rust_cleaned_test_functions.jsonl/130539 | {
"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,
5500,
368,
341,
286,
2060,
10714,
10297,
6400,
5500,
13645,
18,
13,
16,
19,
68,
12,
19,
1827,
15454,
1507,
5624,
486,
5442,
4080,
15,
13,
15,
15,
15,
62,
18,
16,
19,
1106,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_de_named_map() {
assert_de_tokens(
&DeNamedMap { a: 5, b: 6, c: 7 },
&[
Token::Struct {
name: "DeNamedMap",
len: 3,
},
Token::Str("a"),
Token::I32(5),
Token::Str("b"),
Token::I32(6),
Token::Str("c"),
Token::I32(7),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/56416 | {
"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,
2259,
71834,
5376,
368,
341,
262,
2060,
2259,
28838,
1006,
286,
609,
1912,
15810,
2227,
314,
264,
25,
220,
20,
11,
293,
25,
220,
21,
11,
272,
25,
220,
22,
1153,
286,
609,
9640,
310,
9660,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_branch_truncate() {
let hdr: VecxVs<String> = VecxVs::new();
pnk!(hdr.version_create(VersionName(b"manster0")));
let tval = String::from("value2");
hdr.push(tval.clone());
pnk!(hdr.branch_truncate(INITIAL_BRANCH_NAME));
assert!(hdr.get(0).is_none());
} | rust_cleaned_test_functions.jsonl/92143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28031,
3547,
26900,
368,
341,
262,
1077,
36615,
25,
11312,
87,
51737,
3464,
29,
284,
11312,
87,
51737,
486,
931,
543,
262,
43050,
74,
10297,
28785,
19484,
8657,
7,
5637,
675,
1883,
1,
1515,
3667... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_in_to_main() {
let size = 128;
let mut cache: Cache<usize, usize> = Cache::new(size);
cache.add(1, 1);
assert_eq!(cache.in_.len(), 1);
assert_eq!(cache.main.len(), 0);
cache.add(1, 1);
assert_eq!(cache.in_.len(), 0);
assert_eq!(cache.main.len(), 1);
cache.add(1, 1);
assert_eq!(cache.in_.len(), 0);
assert_eq!(cache.main.len(), 1);
} | rust_cleaned_test_functions.jsonl/96737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
1243,
2346,
11027,
368,
341,
286,
1077,
1379,
284,
220,
16,
17,
23,
280,
286,
1077,
5206,
6500,
25,
19479,
90244,
11,
22301,
29,
284,
19479,
486,
931,
6856,
626,
286,
6500,
1364,
7,
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_global_view_matrix() {
let mut transform = Transform::default();
transform.set_translation_xyz(5.0, 70.1, 43.7);
transform.set_scale(Vector3::new(1.0, 5.0, 8.9));
transform.set_rotation(
UnitQuaternion::rotation_between(
&Vector3::new(-1.0, 1.0, 2.0),
&Vector3::new(1.0, 0.0, 0.0),
)
.unwrap(),
);
assert_ulps_eq!(
transform.global_matrix().try_inverse().unwrap(),
transform.global_view_matrix(),
);
} | rust_cleaned_test_functions.jsonl/41639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19296,
7122,
10193,
368,
341,
286,
1077,
5206,
5165,
284,
15226,
486,
2258,
543,
286,
5165,
980,
49273,
64974,
7,
20,
13,
15,
11,
220,
22,
15,
13,
16,
11,
220,
19,
18,
13,
22,
317,
286,
51... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chrono_utc_value() {
use chrono::{DateTime, NaiveDateTime, Utc};
let timestamp = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(61, 0), Utc);
let value: Value = timestamp.into();
let out: DateTime<Utc> = value.unwrap();
assert_eq!(out, timestamp);
} | rust_cleaned_test_functions.jsonl/46288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2248,
78,
84259,
3142,
368,
341,
286,
990,
80372,
22964,
7689,
11,
12812,
533,
7689,
11,
547,
10413,
2315,
286,
1077,
11441,
284,
6520,
27638,
97768,
6831,
1499,
84259,
8204,
64,
533,
7689,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_until() {
test_executor!(async move {
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
let addr = listener.local_addr().unwrap();
let listener_handle = Task::<Result<usize>>::local(async move {
let mut stream = listener.accept().await?;
let mut buf = Vec::new();
stream.read_until(10, &mut buf).await?;
Ok(buf.len())
})
.detach();
let mut stream = TcpStream::connect(addr).await.unwrap();
let vec = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let b = stream.write(&vec).await.unwrap();
assert_eq!(b, 10);
assert_eq!(listener_handle.await.unwrap().unwrap(), 10);
});
} | rust_cleaned_test_functions.jsonl/43888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
44352,
368,
341,
286,
1273,
81207,
10297,
7692,
3271,
341,
310,
1077,
11446,
284,
64876,
2743,
486,
7666,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
15,
1827,
15454,
543,
310,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_list() {
match super::mailbox(b"iNboX ") {
Ok((_, mb)) => {
assert_eq!(mb, "INBOX");
}
rsp => panic!("unexpected response {:?}", rsp),
}
} | rust_cleaned_test_functions.jsonl/82258 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
368,
341,
286,
2432,
2256,
486,
92447,
1883,
1,
72,
45,
749,
55,
12310,
341,
310,
7622,
1188,
6878,
10016,
593,
589,
341,
394,
2060,
10714,
10297,
3096,
11,
330,
687,
23026,
797,
310,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_proposal_by_proxy() {
setup_for_test();
let mut tests = vec![
Network::new(vec![None, None, None]),
Network::new(vec![None, None, NOP_STEPPER]),
];
for (j, tt) in tests.iter_mut().enumerate() {
// promote 0 the leader
tt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
// propose via follower
tt.send(vec![new_message(2, 2, MessageType::MsgPropose, 1)]);
let want_log = new_raft_log(&[empty_entry(1, 1), new_entry(1, 2, SOME_DATA)], 3, 2);
let base = ltoa(&want_log);
for (id, p) in &tt.peers {
if p.raft.is_none() {
continue;
}
let l = ltoa(&p.raft_log);
if l != base {
panic!("#{}: raft_log: {}, want: {}", id, l, base);
}
}
if tt.peers[&1].term != 1 {
panic!("#{}: term = {}, want {}", j, tt.peers[&1].term, 1);
}
}
} | rust_cleaned_test_functions.jsonl/107111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21663,
32556,
3710,
29712,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
7032,
284,
7486,
90515,
286,
8141,
486,
931,
25592,
20703,
4064,
11,
2240,
11,
2240,
17036,
286,
8141,
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... | 6 |
#[test]
fn test_ser_de_fibonacci_interner() {
let mut interner = IntegerInterner::new();
intern_fib(&mut interner, 10, 5);
assert_tokens(
&OrderedIntegerInterner(interner),
&[
Token::Seq { len: Some(5) },
Token::U64(55),
Token::U64(89),
Token::U64(144),
Token::U64(233),
Token::U64(377),
Token::SeqEnd,
],
);
} | rust_cleaned_test_functions.jsonl/14788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
2259,
761,
579,
39345,
4042,
41372,
368,
341,
286,
1077,
5206,
946,
1194,
284,
4440,
1072,
41372,
486,
931,
543,
286,
2590,
761,
579,
2099,
6984,
946,
1194,
11,
220,
16,
15,
11,
220,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_index_expression() {
let filter = NothingFilter;
let source_code = "fn test() -> usize { let a = [0]; 233 }";
assert_source_ok(source_code, Box::new(IndexExpressionValidator), &filter);
} | rust_cleaned_test_functions.jsonl/62638 | {
"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,
6536,
3560,
28068,
368,
341,
286,
1077,
4051,
284,
12064,
5632,
280,
286,
1077,
2530,
4136,
284,
330,
8822,
1273,
368,
1464,
22301,
314,
1077,
264,
284,
508,
15,
5265,
220,
17,
18,
18,
335,
87... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_case_6() {
let key = [
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
];
let message = [
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
];
let expected = [
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
];
poly1305_test_runner(&key, &message, &expected).unwrap();
} | rust_cleaned_test_functions.jsonl/27921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
21,
368,
341,
197,
10217,
1376,
284,
2278,
298,
197,
15,
87,
15,
17,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_peek_mut() {
let data = vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
let mut heap = BinaryHeap::from(data);
assert_eq!(heap.peek(), Some(&10));
{
let mut top = heap.peek_mut().unwrap();
*top -= 2;
}
assert_eq!(heap.peek(), Some(&9));
} | rust_cleaned_test_functions.jsonl/62358 | {
"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,
62,
29107,
29523,
368,
341,
262,
1077,
821,
284,
7486,
20703,
17,
11,
220,
19,
11,
220,
21,
11,
220,
17,
11,
220,
16,
11,
220,
23,
11,
220,
16,
15,
11,
220,
18,
11,
220,
20,
11,
220,
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_derive_decode_variable_size() {
use binstruct_codegen::BinDecode;
#[derive(Debug, BinDecode, PartialEq)]
#[binstruct(mod_path = "crate::serialize")]
struct T {
_1: CString,
}
assert_eq!(T::MIN_SIZE, CString::MIN_SIZE);
assert!(!T::FIXED_SIZE);
let mut buf = BytesMut::new();
buf.put_slice(b"123456\0");
let t = T::decode(&mut buf).unwrap();
assert_eq!(
t,
T {
_1: CString::new("123456").unwrap()
}
);
assert!(!buf.has_remaining());
} | rust_cleaned_test_functions.jsonl/101524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
15227,
14635,
2368,
368,
341,
220,
990,
9544,
1235,
32018,
486,
28794,
32564,
280,
220,
11506,
27098,
42618,
11,
29344,
32564,
11,
55039,
5563,
220,
11506,
6863,
1235,
23351,
2638,
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_partial() {
assert::pass(
r#"
def sum(a, b, *args, **kwargs):
# print("a=%s b=%s args=%s kwargs=%s" % (a, b, args, kwargs))
args = (a, b) + args
return [args, kwargs]
# simple test
assert_eq(
[(1, 2, 3), {"other": True, "third": None}],
(partial(sum, 1, other=True))(2, 3, third=None))
# passing *args **kwargs to partial
assert_eq(
[(1, 2, 3), {"other": True, "third": None}],
(partial(sum, *[1], **{"other": True}))(2, 3, third=None))
# passing *args **kwargs to returned func
assert_eq(
[(1, 2, 3), {"other": True, "third": None}],
(partial(sum, other=True))(*[1, 2, 3], **{"third": None}))
# no args to partial
assert_eq(
[(1, 2, 3), {"other": True, "third": None}],
(partial(sum))(1, 2, 3, third=None, **{"other": True}))
"#,
);
} | rust_cleaned_test_functions.jsonl/37706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
368,
341,
286,
2060,
486,
6385,
1006,
310,
435,
2,
698,
750,
2629,
2877,
11,
293,
11,
353,
2116,
11,
3070,
9674,
982,
262,
671,
1173,
445,
64,
7846,
82,
293,
7846,
82,
2827,
7846,
82,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_stdout_of_command() {
let command = "exa";
let output = get_stdout_of_command(command);
assert_eq!(output, "Cargo.lock
Cargo.toml
CONTRIBUTING.md
docs
examples
LICENSE
Makefile
README.md
rust-core-dev.sublime-project
rust-core-dev.sublime-workspace
src
static
target
tests
TODO.md
");
} | rust_cleaned_test_functions.jsonl/2761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
67416,
3575,
10811,
368,
341,
286,
1077,
3210,
284,
330,
327,
64,
876,
286,
1077,
2550,
284,
633,
67416,
3575,
10811,
15143,
317,
286,
2060,
10714,
10297,
3006,
11,
330,
98228,
21003,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_script_dependency_fails_verification() {
let mut executor = FakeExecutor::from_genesis_with_options(VMPublishingOption::open());
executor.set_golden_file(current_function_name!());
// Get a module that fails verification into the store.
let (module, bytes) = bad_module();
executor.add_module(&module.self_id(), bytes);
// Create a module that tries to use that module.
let sender = executor.create_raw_account_data(1_000_000, 10);
executor.add_account_data(&sender);
let code = "
import 0x1.Test;
main() {
let x: Test.S1;
x = Test.new_S1();
return;
}
";
let compiler = Compiler {
address: *sender.address(),
// This is OK because we *know* the module is unverified.
extra_deps: vec![module],
..Compiler::default()
};
let script = compiler
.into_script_blob("file_name", code)
.expect("Failed to compile");
let txn = sender
.account()
.transaction()
.script(Script::new(script, vec![], vec![]))
.sequence_number(10)
.max_gas_amount(100_000)
.gas_unit_price(1)
.sign();
// invariant violation as we try to load `Test`
assert_eq!(executor.verify_transaction(txn.clone()).status(), None);
match executor.execute_transaction(txn).status() {
TransactionStatus::Discard(status) => {
assert_eq!(status, &StatusCode::UNEXPECTED_VERIFIER_ERROR);
}
_ => panic!("Kept transaction with an invariant violation!"),
}
} | rust_cleaned_test_functions.jsonl/38967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 674
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14660,
62387,
761,
6209,
84245,
368,
341,
262,
1077,
5206,
31558,
284,
36965,
25255,
486,
1499,
16322,
13774,
6615,
8743,
12410,
5781,
2538,
287,
5341,
486,
2508,
1423,
262,
31558,
980,
54696,
268,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_new() {
let local_node_id = test_node_id(1);
let local_node_quorum_set = QuorumSet::<ResponderId>::empty();
let network_state =
SCPNetworkState::<ResponderId>::new(local_node_id.responder_id, local_node_quorum_set);
assert_eq!(network_state.peer_to_current_slot().len(), 0);
} | rust_cleaned_test_functions.jsonl/60947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
1077,
2205,
5084,
842,
284,
1273,
5084,
842,
7,
16,
317,
286,
1077,
2205,
5084,
11280,
33006,
2602,
284,
3406,
33006,
1649,
27638,
30884,
764,
6831,
3194,
543,
286,
1077,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_key_set_invalid_did_errors() {
let _setup = SetupDefaults::init();
let for_did = "11235yBzrpJQmNyZzgoT";
let res = create_keys()
.for_did(for_did)
.unwrap_err();
assert_eq!(res.kind(), VcxErrorKind::InvalidDid);
} | rust_cleaned_test_functions.jsonl/18563 | {
"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,
8657,
3097,
2602,
31433,
814,
307,
20196,
368,
341,
286,
1077,
716,
15188,
284,
18626,
16273,
486,
2327,
1428,
286,
1077,
369,
814,
307,
284,
330,
16,
16,
17,
18,
20,
88,
33,
89,
22252,
41,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_if_ancestor() {
let path = ActorPath::from("/acme/building/room/sensor");
let parent = path.parent();
assert!(parent.is_ancestor_of(&path));
assert!(!path.is_ancestor_of(&path));
} | rust_cleaned_test_functions.jsonl/32095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
62,
66878,
368,
341,
286,
1077,
1815,
284,
24718,
1820,
486,
1499,
4283,
580,
2660,
30593,
287,
14,
2966,
2687,
3805,
797,
286,
1077,
2681,
284,
1815,
8659,
543,
286,
2060,
10297,
3765,
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 |
#[test]
fn test_cmc_refunds_on_failure_to_get_exchange_rate() {
local_test_on_nns_subnet(|runtime| async move {
let account = AccountIdentifier::new(*TEST_USER1_PRINCIPAL, None);
let icpts = Tokens::new(100, 0).unwrap();
// convenience.
let subaccount: Subaccount = GOVERNANCE_CANISTER_ID.get_ref().into();
let nns_init_payload = NnsInitPayloadsBuilder::new()
.with_initial_invariant_compliant_mutations()
.with_test_neurons()
.with_ledger_account(account, icpts)
.build();
let nns_canisters = NnsCanisters::set_up(&runtime, nns_init_payload).await;
let total_cycles_minted_initial: u64 = nns_canisters
.cycles_minting
.query_("total_cycles_minted", protobuf, ())
.await
.unwrap();
let cycles_response = send_cycles(
icpts,
&nns_canisters.ledger,
MEMO_CREATE_CANISTER,
&subaccount,
)
.await;
match cycles_response {
CyclesResponse::Refunded(_, _) => (),
_ => panic!("Failed to be refunded"),
}
let expected_balance_after_refund = Tokens::from_e8s(9999970000);
let cycles_response = send_cycles(
expected_balance_after_refund,
&nns_canisters.ledger,
MEMO_TOP_UP_CANISTER,
&subaccount,
)
.await;
match cycles_response {
CyclesResponse::Refunded(_, _) => (),
_ => panic!("Failed to be refunded"),
}
let final_balance: Tokens = nns_canisters
.ledger
.query_from_sender(
"account_balance_pb",
protobuf,
AccountBalanceArgs { account },
&Sender::from_keypair(&TEST_USER1_KEYPAIR),
)
.await
.unwrap();
assert_eq!(final_balance.get_e8s(), 9999940000);
let total_cycles_minted_final: u64 = nns_canisters
.cycles_minting
.query_("total_cycles_minted", protobuf, ())
.await
.unwrap();
assert_eq!(total_cycles_minted_initial, total_cycles_minted_final);
Ok(())
});
} | rust_cleaned_test_functions.jsonl/88850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
12887,
7793,
42950,
4470,
43618,
2346,
3062,
59212,
9246,
368,
341,
262,
2205,
4452,
4470,
1089,
4412,
95681,
22428,
22255,
91,
3312,
3271,
341,
286,
1077,
2692,
284,
8615,
8714,
486,
931,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_avoidances() {
let inp1 = "highways|ferries|indoors|tolls";
let inp2 = "";
let inp3 = "unknown|tolls";
let res1 = Avoidances::new(&vec![
Avoidance::Tolls,
Avoidance::Highways,
Avoidance::Ferries,
Avoidance::Indoors,
]);
let res2 = Avoidances::new(&Vec::new());
assert_eq!(res1, inp1.parse().unwrap());
assert_eq!(res2, inp2.parse().unwrap());
assert!(inp3.parse::<Avoidances>().is_err());
} | rust_cleaned_test_functions.jsonl/75491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
26173,
588,
3020,
368,
341,
286,
1077,
32344,
16,
284,
330,
11892,
2284,
91,
802,
4019,
91,
34999,
1087,
91,
83,
67878,
876,
286,
1077,
32344,
17,
284,
5438,
286,
1077,
32344,
18,
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_typecheck_prog_sad() {
// the lambda lifted expression should not be valid.
let exp = parse(
&lexpr::from_str(
r#"(let ((f (lambda ((x : int)) : (-> int int)
(lambda ((y : int)) : int (+ x y)))))
((f 4) 3))"#,
)
.unwrap(),
)
.unwrap();
let prog = lambda_lift(&exp).unwrap();
assert_eq!(type_check_prog(&prog).is_err(), true);
} | rust_cleaned_test_functions.jsonl/98589 | {
"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,
1819,
2028,
60390,
643,
329,
368,
341,
1066,
262,
442,
279,
12459,
29731,
7493,
1265,
537,
387,
2697,
624,
262,
1077,
1343,
284,
4715,
1006,
286,
609,
2571,
649,
486,
1499,
2895,
1006,
310,
435,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_activate_for_sanity() {
let a_0 = agent::ZeroAgent::new("tcp://127.0.0.1:5002".to_string());
a_0.activate();
let a_1 = agent::ZeroAgent::new("tcp://127.0.0.1:5003".to_string());
a_1.add_peer("tcp://127.0.0.1:5002".to_string());
a_1.activate();
thread::sleep(time::Duration::from_millis(2 * agent::WAIT));
send_kill("tcp://127.0.0.1:5003");
thread::sleep(time::Duration::from_secs(2 * agent::TIMEOUT));
assert_eq!(
a_0.peers.lock().unwrap().to_vec(),
vec!["tcp://127.0.0.1:5002"]
);
send_kill("tcp://127.0.0.1:5002");
} | rust_cleaned_test_functions.jsonl/104681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67894,
5478,
643,
38270,
368,
341,
286,
1077,
264,
62,
15,
284,
8315,
486,
17999,
16810,
486,
931,
445,
27161,
1110,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
20,
15,
15,
17,
3263,
983,
3904... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec_clone() {
let mut vec = Array::<_, 512>::new();
for idx in 0..vec.capacity() {
assert!(vec.push(idx).is_none());
}
let mut cloned = vec.clone();
assert_eq!(cloned.len(), vec.len());
assert_eq!(cloned, vec);
assert_eq!(cloned, vec.as_slice());
for idx in (0..vec.capacity()).rev() {
assert_eq!(idx, cloned.pop().unwrap());
}
} | rust_cleaned_test_functions.jsonl/105178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
54742,
368,
341,
286,
1077,
5206,
7486,
284,
2910,
27638,
6878,
220,
20,
16,
17,
6831,
931,
543,
286,
369,
7187,
304,
220,
15,
496,
4083,
59168,
368,
341,
310,
2060,
10297,
4083,
2552,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_update_cost_model_with_error_execute_timings() {
let cost_model = Arc::new(RwLock::new(CostModel::default()));
let mut execute_timings = ExecuteTimings::default();
let program_key_1 = Pubkey::new_unique();
// `accumulated_units` == 0
{
execute_timings.details.per_program_timings.insert(
program_key_1,
ProgramTiming {
accumulated_us: 1000,
accumulated_units: 0,
count: 0,
errored_txs_compute_consumed: vec![],
total_errored_units: 0,
},
);
CostUpdateService::update_cost_model(&cost_model, &mut execute_timings);
// nothing should be inserted into the cost model
assert!(cost_model
.read()
.unwrap()
.get_instruction_cost_table()
.is_empty());
}
// Test updating cost model with only erroring compute costs where the `cost_per_error` is
// greater than the current instruction cost for the program. Should update with the
// new erroring compute costs
let cost_per_error = 1000;
{
let errored_txs_compute_consumed = vec![cost_per_error; 3];
let total_errored_units = errored_txs_compute_consumed.iter().sum();
execute_timings.details.per_program_timings.insert(
program_key_1,
ProgramTiming {
accumulated_us: 1000,
accumulated_units: 0,
count: 0,
errored_txs_compute_consumed,
total_errored_units,
},
);
CostUpdateService::update_cost_model(&cost_model, &mut execute_timings);
assert_eq!(
1,
cost_model
.read()
.unwrap()
.get_instruction_cost_table()
.len()
);
assert_eq!(
Some(&cost_per_error),
cost_model
.read()
.unwrap()
.get_instruction_cost_table()
.get(&program_key_1)
);
}
// Test updating cost model with only erroring compute costs where the error cost is
// The cost should not decrease for these new lesser errors
let smaller_cost_per_error = cost_per_error - 10;
{
let errored_txs_compute_consumed = vec![smaller_cost_per_error; 3];
let total_errored_units = errored_txs_compute_consumed.iter().sum();
execute_timings.details.per_program_timings.insert(
program_key_1,
ProgramTiming {
accumulated_us: 1000,
accumulated_units: 0,
count: 0,
errored_txs_compute_consumed,
total_errored_units,
},
);
CostUpdateService::update_cost_model(&cost_model, &mut execute_timings);
assert_eq!(
1,
cost_model
.read()
.unwrap()
.get_instruction_cost_table()
.len()
);
assert_eq!(
Some(&cost_per_error),
cost_model
.read()
.unwrap()
.get_instruction_cost_table()
.get(&program_key_1)
);
}
} | rust_cleaned_test_functions.jsonl/107049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
15890,
5047,
6615,
4096,
44329,
29087,
819,
368,
341,
286,
1077,
2783,
5047,
284,
19689,
486,
931,
2785,
86,
11989,
486,
931,
3025,
535,
1712,
486,
2258,
7392,
286,
1077,
5206,
9026,
29087,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dotted_path() {
let text = "{ foo.bar }";
let instructions = compile(text).unwrap();
assert_eq!(1, instructions.len());
assert_eq!(
&Value(vec![PathStep::Name("foo"), PathStep::Name("bar")]),
&instructions[0]
);
} | rust_cleaned_test_functions.jsonl/18170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
15521,
2638,
368,
972,
286,
1077,
1467,
284,
13868,
15229,
22001,
335,
3534,
286,
1077,
11221,
284,
19192,
7235,
568,
15454,
1647,
286,
2060,
10714,
10297,
16,
11,
11221,
19406,
6201,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_numeric() {
assert_eq!(true, is_numeric("-42"));
assert_eq!(true, is_numeric("0x123456789ABCDEF"));
assert_eq!(true, is_numeric("0x123456789abcdef"));
} | rust_cleaned_test_functions.jsonl/86266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
29418,
368,
341,
286,
2060,
10714,
10297,
1866,
11,
374,
29418,
13645,
19,
17,
4010,
286,
2060,
10714,
10297,
1866,
11,
374,
29418,
445,
15,
87,
16,
17,
18,
19,
20,
21,
22,
23,
24,
254... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_failed_assign() {
let mut assigned_addresses = HashMap::new();
let _res = assign_client_address(
&mut assigned_addresses,
get_test_id(),
"192.168.1.255".parse().unwrap(),
24,
);
let res = assign_client_address(
&mut assigned_addresses,
get_random_id(),
"192.168.1.255".parse().unwrap(),
24,
);
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/87695 | {
"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,
35060,
20688,
368,
341,
286,
1077,
5206,
12607,
59471,
284,
10528,
486,
931,
543,
286,
1077,
716,
416,
284,
9793,
8179,
6744,
1006,
310,
609,
6984,
12607,
59471,
345,
310,
633,
4452,
842,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_instance() {
let instance = create_vea_instance();
let caps = instance.get_capabilities();
assert_ne!(caps.input_formats.len(), 0);
assert_ne!(caps.output_formats.len(), 0);
} | rust_cleaned_test_functions.jsonl/29967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
11904,
368,
341,
262,
1077,
2867,
284,
1855,
73285,
64,
11904,
543,
262,
1077,
18568,
284,
2867,
670,
92092,
1428,
262,
2060,
13925,
10297,
48233,
10046,
68351,
19406,
1507,
220,
15,
317,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_home_archive_old_address() {
let dir = tempdir().unwrap();
fs::create_dir_all(dir.path().join(".shuffle/accounts/latest")).unwrap();
let home = Home::new(dir.path()).unwrap();
let private_key = home.generate_key_file().unwrap();
home.generate_address_file(&private_key.public_key())
.unwrap();
let address_path = dir.path().join(".shuffle/accounts/latest/address");
let time = duration_since_epoch();
let archived_dir = home.create_archive_dir(time).unwrap();
home.archive_old_address(&archived_dir).unwrap();
let test_archive_address_path = dir
.path()
.join(".shuffle/accounts")
.join(time.as_secs().to_string())
.join("address");
let old_address = fs::read_to_string(address_path).unwrap();
let archived_address = fs::read_to_string(test_archive_address_path).unwrap();
assert_eq!(old_address, archived_address);
} | rust_cleaned_test_functions.jsonl/123534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21653,
42873,
21108,
6744,
368,
341,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
543,
286,
8619,
486,
3182,
4334,
5705,
14161,
3875,
1005,
5987,
5680,
65355,
83743,
33149,
15197,
15454,
1428,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_utf8_single_column_reader_test() {
let message_type = "
message test_schema {
REQUIRED BINARY leaf (UTF8);
}
";
let converter = Utf8ArrayConverter {};
single_column_reader_test::<
ByteArrayType,
StringArray,
Utf8ArrayConverter,
RandUtf8Gen,
>(2, 100, 2, message_type, 15, 50, converter);
} | rust_cleaned_test_functions.jsonl/125242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39453,
23,
19487,
8744,
22306,
4452,
368,
341,
286,
1077,
1943,
1819,
284,
6228,
286,
1943,
1273,
25371,
341,
688,
66577,
425,
32593,
15933,
320,
8561,
23,
317,
286,
456,
286,
41620,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_rsb_imm() {
assert_eq!(
decode_16(0x4242),
Instruction::RSB_imm {
params: Reg2ImmParams {
rd: Reg::R2,
rn: Reg::R0,
imm32: 0,
setflags: SetFlags::NotInITBlock,
},
thumb32: false
}
);
} | rust_cleaned_test_functions.jsonl/64785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
1710,
16892,
71370,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
16,
21,
7,
15,
87,
19,
17,
19,
17,
1326,
286,
29051,
486,
11451,
33,
71370,
341,
310,
3628,
25,
3184,
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... | 1 |
#[test]
fn test_cross_join() -> Result<()> {
let df1 = df![
"a" => ["a", "b", "a"],
"b" => [Some(1), None, None]
]?;
let df2 = df![
"a" => [1, 2],
"b" => [None, Some(12)]
]?;
let out = df1.lazy().cross_join(df2.lazy()).collect()?;
assert_eq!(out.shape(), (6, 4));
Ok(())
} | rust_cleaned_test_functions.jsonl/154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35284,
31017,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
16,
284,
6764,
90515,
286,
330,
64,
1,
589,
4383,
64,
497,
330,
65,
497,
330,
64,
8097,
286,
330,
65,
1,
589,
508,
8373,
7,
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... | 4 |
#[test]
fn test_more_complex_diff() {
let old = Element {
id: vec![0],
name: std::borrow::Cow::Borrowed("div"),
attributes: hashmap! {
"class".into() => "message-list".into(),
},
listeners: vec![],
children: vec![
Element {
id: vec![0, 0],
name: std::borrow::Cow::Borrowed("div"),
attributes: hashmap! {},
listeners: vec![],
children: vec![Element {
id: vec![0, 0, 0],
name: std::borrow::Cow::Borrowed("input"),
attributes: hashmap! {},
listeners: vec![ListenerRef::new("msg-input", "input")],
children: vec![],
text: None,
key: None,
}],
text: None,
key: None,
},
Element {
id: vec![0, 1],
name: std::borrow::Cow::Borrowed("div"),
attributes: hashmap! {},
listeners: vec![],
children: vec![Element {
id: vec![0, 1, 0],
name: std::borrow::Cow::Borrowed("button"),
attributes: hashmap! {},
listeners: vec![ListenerRef::new("msg-submit", "click")],
children: vec![],
text: Some(std::borrow::Cow::Borrowed("Send message")),
key: None,
}],
text: None,
key: None,
},
],
text: None,
key: None,
};
let new = Element {
id: vec![0],
name: std::borrow::Cow::Borrowed("div"),
attributes: hashmap! {
"class".into() => "message-list".into(),
},
listeners: vec![],
children: vec![
Element {
id: vec![0, 0],
name: std::borrow::Cow::Borrowed("div"),
attributes: hashmap! {},
listeners: vec![],
children: vec![Element {
id: vec![0, 0, 0],
name: std::borrow::Cow::Borrowed("input"),
attributes: hashmap! {},
listeners: vec![ListenerRef::new(
"msg-input".to_string(),
"input".to_string(),
)],
children: vec![],
text: None,
key: None,
}],
text: None,
key: None,
},
Element {
id: vec![0, 1],
name: std::borrow::Cow::Borrowed("div"),
attributes: hashmap! {},
listeners: vec![],
children: vec![Element {
id: vec![0, 1, 0],
name: std::borrow::Cow::Borrowed("button"),
attributes: hashmap! {},
listeners: vec![ListenerRef::new(
"msg-submit".to_string(),
"click".to_string(),
)],
children: vec![],
text: Some(std::borrow::Cow::Borrowed("Send message")),
key: None,
}],
text: None,
key: None,
},
Element {
id: vec![0, 2],
name: std::borrow::Cow::Borrowed("div"),
attributes: hashmap! {
"class".into() => "message-container".into(),
},
listeners: vec![],
children: vec![
Element {
id: vec![0, 2, 0],
name: std::borrow::Cow::Borrowed("p"),
attributes: hashmap! {
"class".into() => "message-sent-at".into(),
},
listeners: vec![],
children: vec![],
text: Some(std::borrow::Cow::Borrowed("1970-01-25 06:34:13")),
key: None,
},
Element {
id: vec![0, 2, 1],
name: std::borrow::Cow::Borrowed("p"),
attributes: hashmap! {
"class".into() => "message-author".into(),
},
listeners: vec![],
children: vec![],
text: Some(std::borrow::Cow::Borrowed("[username not set]")),
key: None,
},
Element {
id: vec![0, 2, 2],
name: std::borrow::Cow::Borrowed("p"),
attributes: hashmap! {
"class".into() => "message-contents".into(),
},
listeners: vec![],
children: vec![],
text: Some(std::borrow::Cow::Borrowed("sending message")),
key: None,
},
],
text: None,
key: None,
},
],
text: None,
key: None,
};
let c = old.diff(Some(&new));
insta::assert_debug_snapshot!(c);
} | rust_cleaned_test_functions.jsonl/125803 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3520
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36664,
41522,
15850,
368,
341,
262,
1077,
2310,
284,
8543,
341,
286,
877,
25,
7486,
20703,
15,
1259,
286,
829,
25,
1460,
486,
71141,
486,
89915,
486,
33,
7768,
291,
445,
611,
4461,
286,
8201,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_renaming_of_assign_instruction() {
// Given: x := x
let mut instruction = Instruction::assign(variable("x"), variable("x").into()).unwrap();
let mut versioning = VariableVersioning::new();
versioning.start_new_scope();
versioning.new_version(&variable("x")).unwrap();
instruction.rename_variables(&mut versioning).unwrap();
// Expected: x_2 := x_1
assert_eq!(
instruction,
Instruction::assign(variable_ssa("x", 2), variable_ssa("x", 1).into(),).unwrap()
);
} | rust_cleaned_test_functions.jsonl/13494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
77,
6469,
3575,
20688,
54923,
368,
341,
286,
442,
16246,
25,
856,
1669,
856,
198,
286,
1077,
5206,
7600,
284,
29051,
486,
6983,
45029,
445,
87,
3975,
3890,
445,
87,
1827,
18122,
6011,
1545... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator_enumerate_nth() {
let xs = [0, 1, 2, 3, 4, 5];
for (i, &x) in xs.iter().enumerate() {
assert_eq!(i, x);
}
let mut it = xs.iter().enumerate();
while let Some((i, &x)) = it.nth(0) {
assert_eq!(i, x);
}
let mut it = xs.iter().enumerate();
while let Some((i, &x)) = it.nth(1) {
assert_eq!(i, x);
}
let (i, &x) = xs.iter().enumerate().nth(3).unwrap();
assert_eq!(i, x);
assert_eq!(i, 3);
} | rust_cleaned_test_functions.jsonl/25895 | {
"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,
13491,
6205,
3389,
349,
78342,
368,
341,
262,
1077,
11943,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
369,
320,
72,
11,
609,
87,
8,
304,
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... | 4 |
#[test]
fn test_rsplitnator() {
let xs = &[1,2,3,4,5];
let splits: &[&[int]] = &[&[1,2,3,4,5]];
assert_eq!(xs.rsplitn(0, |x| *x % 2 == 0).collect::<Vec<&[int]>>(),
splits);
let splits: &[&[int]] = &[&[5], &[1,2,3]];
assert_eq!(xs.rsplitn(1, |x| *x % 2 == 0).collect::<Vec<&[int]>>(),
splits);
let splits: &[&[int]] = &[&[], &[], &[], &[1,2]];
assert_eq!(xs.rsplitn(3, |_| true).collect::<Vec<&[int]>>(),
splits);
let xs: &[int] = &[];
let splits: &[&[int]] = &[&[]];
assert_eq!(xs.rsplitn(1, |x| *x == 5).collect::<Vec<&[int]>>(), splits);
} | rust_cleaned_test_functions.jsonl/31852 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
6960,
77,
850,
368,
341,
286,
1077,
11943,
284,
44590,
16,
11,
17,
11,
18,
11,
19,
11,
20,
4821,
286,
1077,
40467,
25,
44590,
5,
58,
396,
5053,
284,
44590,
5,
58,
16,
11,
17,
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... | 1 |
#[test]
fn test_read_pipeline() {
let pipeline: Pipeline = read_test_file("pipeline");
assert_eq!(pipeline.id, PipelineId::new(145_400));
assert_eq!(pipeline.project_id, ProjectId::new(855));
assert_eq!(pipeline.status, StatusState::Success);
assert_eq!(pipeline.ref_.as_ref().unwrap(), "master");
assert_eq!(
pipeline.sha,
ObjectId::new("7134adce4522c399cdab16e128b0a1af15b93f14"),
);
assert_eq!(
pipeline.before_sha,
Some(ObjectId::new("0000000000000000000000000000000000000000"))
);
assert!(!pipeline.tag);
assert_eq!(pipeline.yaml_errors, None);
assert_eq!(
pipeline.created_at.unwrap(),
datetime((2019, 9, 3), (18, 9, 47, 178)),
);
assert_eq!(
pipeline.updated_at.unwrap(),
datetime((2019, 9, 3), (18, 15, 47, 18)),
);
assert_eq!(
pipeline.started_at.unwrap(),
datetime((2019, 9, 3), (18, 9, 51, 465)),
);
assert_eq!(
pipeline.finished_at.unwrap(),
datetime((2019, 9, 3), (18, 15, 47, 13)),
);
assert_eq!(pipeline.committed_at, None);
assert_eq!(pipeline.duration, Some(0));
assert_eq!(pipeline.coverage, None);
assert_eq!(
pipeline.web_url,
"https://gitlab.kitware.com/utils/rust-gitlab/-/pipelines/145400",
);
// nested user
check_user_buildbot(&pipeline.user);
// nested detailed status
assert_eq!(
pipeline.detailed_status,
json!({
"details_path": "/utils/rust-gitlab/-/pipelines/145400",
"favicon": "/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png",
"group": "success",
"has_details": true,
"icon": "status_success",
"illustration": null,
"label": "passed",
"text": "passed",
"tooltip": "passed",
}),
);
} | rust_cleaned_test_functions.jsonl/12958 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 951
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
45187,
368,
341,
262,
1077,
15301,
25,
40907,
284,
1349,
4452,
2458,
445,
51258,
3071,
262,
2060,
10714,
10297,
51258,
1764,
11,
40907,
764,
486,
931,
7,
16,
19,
20,
62,
19,
15,
15,
1106... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_required_version() {
assert_eq!(
ExtXSessionKey::new(DecryptionKey::new(
EncryptionMethod::Aes128,
"https://www.example.com/"
))
.required_version(),
ProtocolVersion::V1
);
} | rust_cleaned_test_functions.jsonl/28211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18743,
9438,
368,
341,
286,
2060,
10714,
33673,
310,
9447,
55,
5283,
1592,
486,
931,
7,
4900,
15597,
1592,
486,
931,
1006,
394,
62055,
3523,
486,
32,
288,
16,
17,
23,
345,
394,
330,
2428,
1110... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_path_with_trailing_slashes() {
new_ucmd!().arg("/root/alpha/beta/gamma/delta/epsilon/omega//")
.run().stdout_is("/root/alpha/beta/gamma/delta/epsilon\n");
} | rust_cleaned_test_functions.jsonl/27178 | {
"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,
2638,
6615,
3547,
14277,
11886,
14051,
368,
341,
262,
501,
68887,
2277,
0,
1005,
858,
4283,
2888,
14,
7141,
3470,
1915,
4846,
13099,
3446,
5964,
14,
31767,
14,
32696,
322,
1138,
286,
659,
6108,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_documents_open() {
let (mut documents, _) = setup();
let specifier = ModuleSpecifier::parse("file:///a.ts").unwrap();
let content = Arc::new(
r#"import * as b from "./b.ts";
console.log(b);
"#
.to_string(),
);
let document =
documents.open(specifier, 1, "javascript".parse().unwrap(), content);
assert!(document.is_open());
assert!(document.is_diagnosable());
} | rust_cleaned_test_functions.jsonl/53615 | {
"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,
75927,
11311,
368,
341,
262,
1077,
320,
6984,
9293,
11,
27439,
284,
6505,
543,
262,
1077,
97616,
284,
13711,
87297,
486,
6400,
445,
1192,
60896,
64,
21288,
1827,
15454,
543,
262,
1077,
2213,
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_mark_dirty() {
let mut buf1 = vec![0x0u8; 16];
let bitmap1 = AtomicBitmap::new(16, 2);
assert_eq!(bitmap1.len(), 8);
for i in 0..8 {
assert_eq!(bitmap1.is_bit_set(i), false);
}
let mut buf2 = vec![0x0u8; 16];
let bitmap2 = AtomicBitmap::new(16, 2);
let mut bufs = VecDeque::new();
unsafe {
bufs.push_back(VolatileSlice::with_bitmap(
buf1.as_mut_ptr(),
buf1.len(),
bitmap1.slice_at(0),
));
bufs.push_back(VolatileSlice::with_bitmap(
buf2.as_mut_ptr(),
buf2.len(),
bitmap2.slice_at(0),
));
}
let mut buffers = IoBuffers {
buffers: bufs,
bytes_consumed: 0,
};
assert_eq!(buffers.available_bytes(), 32);
assert_eq!(buffers.bytes_consumed(), 0);
assert_eq!(
buffers.consume_for_read(8, |buf| Ok(buf[0].len())).unwrap(),
8
);
assert_eq!(buffers.available_bytes(), 24);
assert_eq!(buffers.bytes_consumed(), 8);
for i in 0..8 {
assert_eq!(bitmap1.is_bit_set(i), false);
}
assert_eq!(
buffers
.consume(true, 16, |buf| Ok(buf[0].len() + buf[1].len()))
.unwrap(),
16
);
assert_eq!(buffers.available_bytes(), 8);
assert_eq!(buffers.bytes_consumed(), 24);
for i in 0..8 {
if i >= 4 {
assert_eq!(bitmap1.is_bit_set(i), true);
continue;
} else {
assert_eq!(bitmap1.is_bit_set(i), false);
}
}
for i in 0..8 {
if i < 4 {
assert_eq!(bitmap2.is_bit_set(i), true);
} else {
assert_eq!(bitmap2.is_bit_set(i), false);
}
}
} | rust_cleaned_test_functions.jsonl/17350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18924,
63642,
368,
341,
286,
1077,
5206,
6607,
16,
284,
7486,
20703,
15,
87,
15,
84,
23,
26,
220,
16,
21,
935,
286,
1077,
19746,
16,
284,
30316,
16773,
486,
931,
7,
16,
21,
11,
220,
17,
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... | 7 |
#[test]
fn test_val() {
let mut p = Parser::new();
assert_eq!(p.val("[4,9]").1, Done("",
Rc::new(RefCell::new(TOMLValue::Array(Rc::new(RefCell::new(Array::new(
vec![
ArrayValue::new(
Rc::new(RefCell::new(TOMLValue::Integer("4".into()))), Some(WSSep::new_str("", "")),
vec![CommentOrNewLines::NewLines("".into())]
),
ArrayValue::new(
Rc::new(RefCell::new(TOMLValue::Integer("9".into()))), None,
vec![CommentOrNewLines::NewLines("".into())]
),
],
vec![CommentOrNewLines::NewLines("".into())], vec![CommentOrNewLines::NewLines("".into())]
))
))))));
p = Parser::new();
assert_eq!(p.val("{\"§ô₥è Þïϱ\"='TáƨÆÂ¥ Þôřƙ'}").1, Done("",
Rc::new(RefCell::new(TOMLValue::InlineTable(Rc::new(RefCell::new(InlineTable::new(
vec![
TableKeyVal::new(
KeyVal::new_str(
"\"§ô₥è Þïϱ\"", WSSep::new_str("", ""),
Rc::new(RefCell::new(TOMLValue::String("TáƨÆÂ¥ Þôřƙ".into(), StrType::Literal)))
),
None,
vec![]
)
],
WSSep::new_str("", "")
))))))));
p = Parser::new();
assert_eq!(p.val("2112-09-30T12:33:01.345-11:30").1, Done("", Rc::new(RefCell::new(TOMLValue::DateTime(
DateTime::new(Date::new_str("2112", "09", "30"), Some(Time::new_str("12", "33", "01", Some("345"),
Some(TimeOffset::Time(TimeOffsetAmount::new_str("-", "11", "30"))
)))))))));
p = Parser::new();
assert_eq!(p.val("3487.3289E+22").1, Done("", Rc::new(RefCell::new(TOMLValue::Float("3487.3289E+22".into())))));
p = Parser::new();
assert_eq!(p.val("8932838").1, Done("", Rc::new(RefCell::new(TOMLValue::Integer("8932838".into())))));
p = Parser::new();
assert_eq!(p.val("false").1, Done("", Rc::new(RefCell::new(TOMLValue::Boolean(false)))));
p = Parser::new();
assert_eq!(p.val("true").1, Done("", Rc::new(RefCell::new(TOMLValue::Boolean(true)))));
p = Parser::new();
assert_eq!(p.val("'§ô₥è §ÆÅ™Ã¯Ã±Ï±'").1, Done("", Rc::new(RefCell::new(TOMLValue::String(
"§ô₥è §ÆÅ™Ã¯Ã±Ï±".into(), StrType::Literal
)))));
} | rust_cleaned_test_functions.jsonl/27423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6189,
368,
341,
262,
1077,
5206,
281,
284,
21102,
486,
931,
543,
262,
2060,
10714,
10297,
79,
10835,
10937,
19,
11,
24,
44891,
16,
11,
27357,
445,
756,
414,
81463,
486,
931,
7,
3945,
3599,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compare_clocks_with_hour_overflow_by_several_days() {
assert_eq!(Clock::new(3, 11), Clock::new(99, 11));
} | rust_cleaned_test_functions.jsonl/5381 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 62
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32235,
23062,
82,
6615,
32292,
79073,
3710,
3453,
17539,
28353,
368,
341,
262,
2060,
10714,
10297,
26104,
486,
931,
7,
18,
11,
220,
16,
16,
701,
26142,
486,
931,
7,
24,
24,
11,
220,
16,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_plus_reduce_money() {
let bank = Bank::new();
let money = Money::dollar(1).into();
let reduced = bank.reduce(money, Dollar.into());
assert_eq!(Money::dollar(1), reduced);
} | rust_cleaned_test_functions.jsonl/115306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28043,
64596,
34065,
368,
341,
286,
1077,
6073,
284,
8547,
486,
931,
543,
286,
1077,
3220,
284,
17633,
486,
67,
21295,
7,
16,
568,
18122,
543,
286,
1077,
11046,
284,
6073,
23792,
1255,
2534,
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 |
#[test]
fn test_apt_cache() {
assert!(apt_cache("search", "bash", &search)
.unwrap()
.contains(&"bash".to_string()));
assert!(apt_cache("search", "does-not-exist", &search).is_none());
} | rust_cleaned_test_functions.jsonl/6491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2689,
11529,
368,
341,
286,
2060,
10297,
2689,
11529,
445,
1836,
497,
330,
46216,
497,
609,
1836,
340,
310,
659,
15454,
741,
310,
659,
13372,
2099,
1,
46216,
3263,
983,
3904,
7392,
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 |
#[test]
fn test_compressor_init() {
let compressor_params = CompressorParams::new();
let mut compressor = Compressor::default();
unsafe {
compressor.init(&compressor_params);
}
std::mem::drop(compressor);
std::mem::drop(compressor_params);
} | rust_cleaned_test_functions.jsonl/63443 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
56220,
6137,
368,
341,
262,
1077,
58877,
6745,
284,
1198,
56220,
4870,
486,
931,
543,
262,
1077,
5206,
58877,
284,
1198,
56220,
486,
2258,
543,
262,
19860,
341,
286,
58877,
8271,
2099,
38360... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_err_monitor_lockdown() {
// Our monitor will lock update of local commitment transaction if a broadcastion condition
// has been fulfilled (either force-close from Channel or block height requiring a HTLC-
// triggering a timeout while a slow-block-processing ChannelManager receives a local signed
// commitment at same time.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
// Create some initial channel
let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let outpoint = OutPoint { txid: chan_1.3.txid(), index: 0 };
// Rebalance the network to generate htlc in the two directions
send_payment(&nodes[0], &vec!(&nodes[1])[..], 10_000_000);
let preimage = route_payment(&nodes[0], &vec!(&nodes[1])[..], 9_000_000).0;
// Copy ChainMonitor to simulate a watchtower and update block height of node 0 until its ChannelMonitor timeout HTLC onchain
let chain_source = test_utils::TestChainSource::new(Network::Testnet);
let logger = test_utils::TestLogger::with_id(format!("node {}", 0));
let persister = test_utils::TestPersister::new();
let watchtower = {
let monitors = nodes[0].chain_monitor.chain_monitor.monitors.read().unwrap();
let monitor = monitors.get(&outpoint).unwrap();
let mut w = test_utils::TestVecWriter(Vec::new());
monitor.write(&mut w).unwrap();
let new_monitor = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingSigner>)>::read(
&mut io::Cursor::new(&w.0), &test_utils::OnlyReadsKeysInterface {}).unwrap().1;
assert!(new_monitor == *monitor);
let watchtower = test_utils::TestChainMonitor::new(Some(&chain_source), &chanmon_cfgs[0].tx_broadcaster, &logger, &chanmon_cfgs[0].fee_estimator, &persister, &node_cfgs[0].keys_manager);
assert!(watchtower.watch_channel(outpoint, new_monitor).is_ok());
watchtower
};
let header = BlockHeader { version: 0x20000000, prev_blockhash: Default::default(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
// Make the tx_broadcaster aware of enough blocks that it doesn't think we're violating
// transaction lock time requirements here.
chanmon_cfgs[0].tx_broadcaster.blocks.lock().unwrap().resize(200, (header, 0));
watchtower.chain_monitor.block_connected(&Block { header, txdata: vec![] }, 200);
// Try to update ChannelMonitor
assert!(nodes[1].node.claim_funds(preimage));
check_added_monitors!(nodes[1], 1);
let updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
assert_eq!(updates.update_fulfill_htlcs.len(), 1);
nodes[0].node.handle_update_fulfill_htlc(&nodes[1].node.get_our_node_id(), &updates.update_fulfill_htlcs[0]);
if let Some(ref mut channel) = nodes[0].node.channel_state.lock().unwrap().by_id.get_mut(&chan_1.2) {
if let Ok((_, _, update)) = channel.commitment_signed(&updates.commitment_signed, &node_cfgs[0].logger) {
if let Err(_) = watchtower.chain_monitor.update_channel(outpoint, update.clone()) {} else { assert!(false); }
if let Ok(_) = nodes[0].chain_monitor.update_channel(outpoint, update) {} else { assert!(false); }
} else { assert!(false); }
} else { assert!(false); };
// Our local monitor is in-sync and hasn't processed yet timeout
check_added_monitors!(nodes[0], 1);
let events = nodes[0].node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
} | rust_cleaned_test_functions.jsonl/16956 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
9266,
40112,
9818,
2923,
368,
341,
197,
322,
5633,
8718,
686,
5296,
2647,
315,
2205,
15155,
7745,
421,
264,
12899,
290,
2971,
198,
197,
322,
702,
1012,
40734,
320,
49898,
5344,
34462,
504,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_debug() {
let mut buf = [0; 20];
let mut buf = SliceVec::empty(&mut buf);
assert_eq!(format!("{:?}", buf), "[]");
buf.replace(&[0, 1, 2]).unwrap();
assert_eq!(format!("{:?}", buf), "[0, 1, 2]");
} | rust_cleaned_test_functions.jsonl/26325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
26,
220,
17,
15,
935,
286,
1077,
5206,
6607,
284,
56476,
10050,
486,
3194,
2099,
6984,
6607,
626,
286,
2060,
10714,
10297,
2243,
88928,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hover_tuple_has_goto_type_actions() {
check_actions(
r#"
struct A(u32);
struct B(u32);
mod M {
pub struct C(u32);
}
fn main() { let s$0t = (A(1), B(2), M::C(3) ); }
"#,
expect![[r#"
[
GoToType(
[
HoverGotoTypeData {
mod_path: "test::A",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 0..14,
focus_range: 7..8,
name: "A",
kind: Struct,
description: "struct A",
},
},
HoverGotoTypeData {
mod_path: "test::B",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 15..29,
focus_range: 22..23,
name: "B",
kind: Struct,
description: "struct B",
},
},
HoverGotoTypeData {
mod_path: "test::M::C",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 42..60,
focus_range: 53..54,
name: "C",
kind: Struct,
description: "pub struct C",
},
},
],
),
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/66673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1820
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
21773,
21778,
97732,
1819,
25368,
368,
341,
286,
1779,
25368,
1006,
310,
435,
2,
698,
1235,
362,
8154,
18,
17,
317,
1235,
425,
8154,
18,
17,
317,
2593,
386,
341,
262,
6675,
2036,
356,
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_display_departure_time() {
assert_eq!(
"1534284000",
DepartureTime::new(1534284000).unwrap().to_string()
)
} | rust_cleaned_test_functions.jsonl/75485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
69865,
552,
3009,
368,
341,
286,
2060,
10714,
33673,
310,
330,
16,
20,
18,
19,
17,
23,
19,
15,
15,
15,
756,
310,
39755,
552,
1462,
486,
931,
7,
16,
20,
18,
19,
17,
23,
19,
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 |
#[test]
fn test_merge_base_only() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
let ours = commit! {};
let theirs = commit! {};
repo.three_way_merge(ours, theirs)?;
assert!(!exists!(repo: "foo"));
Ok(())
})
} | rust_cleaned_test_functions.jsonl/94153 | {
"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,
20888,
7651,
18410,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
1077,
11350,
284,
5266,
0,
9321,
286,
1077,
47201,
284,
5266,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_is_native_safe() {
let types = create_types();
assert_eq!(types[0].is_native_safe(), true);
assert_eq!(types[1].is_native_safe(), true);
assert_eq!(types[2].is_native_safe(), true);
assert_eq!(types[3].is_native_safe(), false);
assert_eq!(types[4].is_native_safe(), false);
assert_eq!(types[5].is_native_safe(), false);
assert_eq!(types[6].is_native_safe(), true);
assert_eq!(types[7].is_native_safe(), true);
let struct3 = MuType::new(
100,
MuType_::mustruct(
Arc::new("MyStructTag3".to_string()),
vec![types[3].clone(), types[0].clone()]
)
);
assert_eq!(struct3.is_native_safe(), false);
let struct4 = MuType::new(
101,
MuType_::mustruct(
Arc::new("MyStructTag4".to_string()),
vec![types[3].clone(), types[4].clone()]
)
);
assert_eq!(struct4.is_native_safe(), false);
assert_eq!(types[8].is_native_safe(), true);
let ref_array = MuType::new(102, MuType_::array(types[3].clone(), 5));
assert_eq!(ref_array.is_native_safe(), false);
assert_eq!(types[9].is_native_safe(), true);
let fix_ref_hybrid = MuType::new(
103,
MuType_::hybrid(
Arc::new("FixRefHybrid".to_string()),
vec![types[3].clone(), types[0].clone()],
types[0].clone()
)
);
assert_eq!(fix_ref_hybrid.is_native_safe(), false);
let var_ref_hybrid = MuType::new(
104,
MuType_::hybrid(
Arc::new("VarRefHybrid".to_string()),
vec![types[0].clone(), types[1].clone()],
types[3].clone()
)
);
assert_eq!(var_ref_hybrid.is_native_safe(), false);
assert_eq!(types[10].is_native_safe(), true);
assert_eq!(types[11].is_native_safe(), false);
assert_eq!(types[12].is_native_safe(), false);
assert_eq!(types[13].is_native_safe(), false);
assert_eq!(types[14].is_native_safe(), true);
assert_eq!(types[15].is_native_safe(), false); // funcref is not native safe
// and not traced either
assert_eq!(types[16].is_native_safe(), true);
} | rust_cleaned_test_functions.jsonl/29245 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1014
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
44494,
34067,
368,
341,
262,
1077,
4494,
284,
1855,
9763,
1428,
262,
2060,
10714,
10297,
9242,
58,
15,
936,
285,
44494,
34067,
1507,
830,
317,
262,
2060,
10714,
10297,
9242,
58,
16,
936,
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_grouped_vals_push_and_append() {
let mut m = MatchedArg::new();
m.push_val("aaa".into());
m.new_val_group();
m.append_val("bbb".into());
m.append_val("ccc".into());
m.new_val_group();
m.append_val("ddd".into());
m.push_val("eee".into());
m.new_val_group();
m.append_val("fff".into());
m.append_val("ggg".into());
m.append_val("hhh".into());
m.append_val("iii".into());
let vals: Vec<&Vec<OsString>> = m.vals().collect();
assert_eq!(
vals,
vec![
&vec![OsString::from("aaa")],
&vec![OsString::from("bbb"), OsString::from("ccc"),],
&vec![OsString::from("ddd")],
&vec![OsString::from("eee")],
&vec![
OsString::from("fff"),
OsString::from("ggg"),
OsString::from("hhh"),
OsString::from("iii"),
]
]
)
} | rust_cleaned_test_functions.jsonl/39135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 626
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
291,
29550,
14218,
8378,
26041,
368,
341,
286,
1077,
5206,
296,
284,
14152,
291,
2735,
486,
931,
543,
286,
296,
2552,
6189,
445,
32646,
3263,
18122,
1423,
286,
296,
4618,
6189,
6288,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_hex_string() {
let array = [1u8, 2u8, 3u8, 45u8];
assert_eq!("0102032d", to_hex_string(&array));
} | rust_cleaned_test_functions.jsonl/108334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
32655,
3904,
368,
341,
286,
1077,
1334,
284,
508,
16,
84,
23,
11,
220,
17,
84,
23,
11,
220,
18,
84,
23,
11,
220,
19,
20,
84,
23,
935,
286,
2060,
10714,
17223,
15,
16,
15,
17,
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 |
#[test]
fn test_struct_exact() {
// test without verification error
let res = StructExact::parse(&INPUT_16[8..]);
assert!(res.is_ok());
// test with verification error
let res = StructExact::parse(INPUT_16).expect_err("parsing failed");
if let nom::Err::Error(e) = res {
assert_eq!(e.code, nom::error::ErrorKind::Verify);
} else {
panic!("wrong error type");
}
} | rust_cleaned_test_functions.jsonl/48213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
71084,
368,
341,
262,
442,
1273,
2041,
22901,
1465,
198,
262,
1077,
592,
284,
16139,
57954,
486,
6400,
2099,
29421,
62,
16,
21,
58,
23,
496,
2558,
262,
2060,
10297,
416,
2079,
19817,
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... | 2 |
#[test]
fn test_pretty_print() {
let pairs = AbcParser::parse(Rule::a, "abcde").unwrap();
let expected = r#"{
"pos": [
0,
5
],
"pairs": [
{
"pos": [
0,
3
],
"rule": "a",
"inner": {
"pos": [
1,
2
],
"pairs": [
{
"pos": [
1,
2
],
"rule": "b",
"inner": "b"
}
]
}
},
{
"pos": [
4,
5
],
"rule": "c",
"inner": "e"
}
]
}"#;
assert_eq!(expected, pairs.to_json());
} | rust_cleaned_test_functions.jsonl/110494 | {
"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,
620,
21322,
10064,
368,
341,
286,
1077,
13530,
284,
3680,
66,
6570,
486,
6400,
2785,
1111,
486,
64,
11,
330,
13683,
450,
1827,
15454,
1428,
286,
1077,
3601,
284,
435,
55543,
515,
220,
330,
966,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_node_itself() -> Result<()> {
let l = default_logger();
let mut n1 = new_test_learner_raft(1, vec![1], vec![2], 10, 1, new_storage(), &l);
assert!(n1.apply_conf_change(&remove_node(1)).is_err());
assert_iter_eq!(n1.prs().conf().learners(), vec![2]);
assert_iter_eq!(o n1.prs().conf().voters().ids(), vec![1]);
Ok(())
} | rust_cleaned_test_functions.jsonl/19151 | {
"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,
18193,
5084,
14631,
721,
368,
1464,
5714,
71698,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
308,
16,
284,
501,
4452,
62,
93595,
62,
2944,
7,
16,
11,
7486,
20703,
16,
1125,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dict_with_frozen_list_key_inlined() {
let mut a = Assert::new();
a.module(
"m.star",
"\
li = []
def f():
# This should fail at runtime.
return {li: 1}
",
);
a.fail(
"\
load('m.star', 'f')
f()
",
"Value of type `list` is not hashable",
);
} | rust_cleaned_test_functions.jsonl/92453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5243,
6615,
761,
42240,
2019,
3097,
1243,
15121,
368,
341,
262,
1077,
5206,
264,
284,
5319,
486,
931,
543,
262,
264,
10076,
1006,
286,
330,
76,
52582,
756,
286,
93317,
742,
284,
4167,
750,
282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde_reader() {
let s = SmolStr::new("Hello, World");
let s = serde_json::to_string(&s).unwrap();
assert_eq!(s, "\"Hello, World\"");
let s: SmolStr = serde_json::from_reader(std::io::Cursor::new(s)).unwrap();
assert_eq!(s, "Hello, World");
} | rust_cleaned_test_functions.jsonl/106850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
22306,
368,
341,
286,
1077,
274,
284,
4388,
337,
2580,
486,
931,
445,
9707,
11,
4337,
797,
286,
1077,
274,
284,
61570,
9455,
486,
983,
3904,
2099,
82,
568,
15454,
543,
286,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_configuration_limits() {
let mut rng = fastrand::Rng::new();
let secp = secp256k1::Secp256k1::signing_only();
assert_eq!(
DepositDescriptor::new(vec![get_random_pubkey(&mut rng, &secp)])
.unwrap_err()
.to_string(),
ScriptCreationError::BadParameters.to_string()
);
assert_eq!(
UnvaultDescriptor::new(
vec![get_random_pubkey(&mut rng, &secp)],
vec![get_random_pubkey(&mut rng, &secp)],
1,
vec![
get_random_pubkey(&mut rng, &secp),
get_random_pubkey(&mut rng, &secp)
],
6
)
.unwrap_err()
.to_string(),
ScriptCreationError::BadParameters.to_string()
);
assert_eq!(
UnvaultDescriptor::new(
vec![get_random_pubkey(&mut rng, &secp)],
vec![get_random_pubkey(&mut rng, &secp)],
1,
vec![get_random_pubkey(&mut rng, &secp)],
4194305
)
.unwrap_err()
.to_string(),
ScriptCreationError::BadParameters.to_string()
);
assert_eq!(
UnvaultDescriptor::new(
vec![get_random_pubkey(&mut rng, &secp)],
vec![get_random_pubkey(&mut rng, &secp)],
2,
vec![get_random_pubkey(&mut rng, &secp)],
4194305
)
.unwrap_err()
.to_string(),
ScriptCreationError::BadParameters.to_string()
);
// Maximum N-of-N
let participants = (0..99)
.map(|_| get_random_pubkey(&mut rng, &secp))
.collect::<Vec<DescriptorPublicKey>>();
DepositDescriptor::new(participants).expect("Should be OK: max allowed value");
// Now hit the limit
let participants = (0..100)
.map(|_| get_random_pubkey(&mut rng, &secp))
.collect::<Vec<DescriptorPublicKey>>();
assert_eq!(
DepositDescriptor::new(participants)
.unwrap_err()
.to_string(),
ScriptCreationError::PolicyCompilation(CompilerError::LimitsExceeded).to_string()
);
// Maximum 1-of-N
let managers = (0..20)
.map(|_| get_random_pubkey(&mut rng, &secp))
.collect::<Vec<DescriptorPublicKey>>();
CpfpDescriptor::new(managers).expect("Should be OK, that's the maximum allowed value");
// Hit the limit
let managers = (0..21)
.map(|_| get_random_pubkey(&mut rng, &secp))
.collect::<Vec<DescriptorPublicKey>>();
assert_eq!(
CpfpDescriptor::new(managers).unwrap_err().to_string(),
ScriptCreationError::PolicyCompilation(CompilerError::LimitsExceeded).to_string()
);
// Maximum non-managers for 2 managers
let stakeholders = (0..38)
.map(|_| get_random_pubkey(&mut rng, &secp))
.collect::<Vec<DescriptorPublicKey>>();
let managers = (0..2)
.map(|_| get_random_pubkey(&mut rng, &secp))
.collect::<Vec<DescriptorPublicKey>>();
let cosigners = (0..38)
.map(|_| get_random_pubkey(&mut rng, &secp))
.collect::<Vec<DescriptorPublicKey>>();
UnvaultDescriptor::new(stakeholders, managers, 2, cosigners, 145).unwrap();
// Now hit the limit
let stakeholders = (0..39)
.map(|_| get_random_pubkey(&mut rng, &secp))
.collect::<Vec<DescriptorPublicKey>>();
let managers = (0..2)
.map(|_| get_random_pubkey(&mut rng, &secp))
.collect::<Vec<DescriptorPublicKey>>();
let cosigners = (0..39)
.map(|_| get_random_pubkey(&mut rng, &secp))
.collect::<Vec<DescriptorPublicKey>>();
assert_eq!(
UnvaultDescriptor::new(stakeholders, managers, 2, cosigners, 32)
.unwrap_err()
.to_string(),
ScriptCreationError::PolicyCompilation(CompilerError::LimitsExceeded).to_string()
);
} | rust_cleaned_test_functions.jsonl/107280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
35726,
31820,
368,
341,
286,
1077,
5206,
28422,
284,
2218,
85881,
486,
49,
968,
486,
931,
543,
286,
1077,
511,
4672,
284,
511,
4672,
17,
20,
21,
74,
16,
486,
8430,
79,
17,
20,
21,
74,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_unserializable() {
use std::time::Duration;
let system = ActorSystem::create(ActorSystemConfig::default().thread_pool_size(2));
// We declare a message type that we know is unserializable and then we implement the
// `ActorMessage` with the default methods which error on attempting to serialize. Note
// that this could be used for sending any unserialized type in other libs by simply
// wrapping that value in a user-made struct.
struct Foo {}
impl ActorMessage for Foo {}
assert!(Foo {}.to_bincode().is_err());
assert!(Foo::from_bincode(&vec![1, 2, 3]).is_err());
let aid = system
.spawn()
.with(
(),
move |_state: (), context: Context, message: Message| async move {
if let Some(_) = message.content_as::<Foo>() {
context.system.trigger_shutdown();
}
Ok(Status::done(()))
},
)
.unwrap();
aid.send(Message::new(Foo {})).unwrap();
await_received(&aid, 2, 1000).unwrap();
system.await_shutdown(Duration::from_millis(1000));
} | rust_cleaned_test_functions.jsonl/51700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 579
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
4907,
10182,
8335,
368,
341,
286,
990,
1460,
486,
1678,
486,
12945,
401,
286,
1077,
1849,
284,
24718,
2320,
486,
3182,
7,
18870,
2320,
2648,
486,
2258,
1005,
4528,
15709,
2368,
7,
17,
323... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_glyphstyle_arg_conversions() {
let s: usize = GlyphStyle::Small.into();
let r: usize = GlyphStyle::Regular.into();
let b: usize = GlyphStyle::Bold.into();
assert_eq!(GlyphStyle::Small, GlyphStyle::from(s));
assert_eq!(GlyphStyle::Regular, GlyphStyle::from(r));
assert_eq!(GlyphStyle::Bold, GlyphStyle::from(b));
let bad_arg = 255;
assert_eq!(GlyphStyle::Regular, GlyphStyle::from(bad_arg));
} | rust_cleaned_test_functions.jsonl/109308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88703,
3528,
6057,
3382,
28290,
368,
341,
286,
1077,
274,
25,
22301,
284,
87413,
2323,
486,
25307,
39860,
543,
286,
1077,
435,
25,
22301,
284,
87413,
2323,
486,
30404,
39860,
543,
286,
1077,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dec_lit_max_val_exceeded() {
let s = "123456789012345678901234567890123.4567890";
let res = Decimal::<7>::from_str(&s);
assert!(res.is_err());
let err = res.unwrap_err();
assert_eq!(err, ParseDecimalError::MaxValueExceeded);
} | rust_cleaned_test_functions.jsonl/12029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13783,
98399,
6345,
6189,
2702,
94206,
368,
341,
286,
1077,
274,
284,
330,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
16,
17,
18,
19,
20,
21,
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_authorize_url_with_redirect_url() {
let client = new_client()
.set_redirect_uri(RedirectUrl::new("https://localhost/redirect".to_string()).unwrap());
let (url, _) = client
.authorize_url(|| CsrfToken::new("csrf_token".to_string()))
.url();
assert_eq!(
Url::parse(
"https://example.com/auth?response_type=code\
&client_id=aaa\
&state=csrf_token\
&redirect_uri=https%3A%2F%2Flocalhost%2Fredirect"
)
.unwrap(),
url
);
} | rust_cleaned_test_functions.jsonl/18589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22938,
551,
2903,
6615,
30043,
2903,
368,
341,
262,
1077,
2943,
284,
501,
8179,
741,
286,
659,
746,
30043,
15572,
2785,
291,
1226,
2864,
486,
931,
445,
2428,
1110,
8301,
14,
8117,
3263,
983,
390... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_read_full_range() {
let nodes = 24u32;
let graph = StackedBucketGraph::<PoseidonHasher>::new_stacked(
nodes as usize,
BASE_DEGREE,
EXP_DEGREE,
[0u8; 32],
)
.unwrap();
let mut cache = ParentCache::new(nodes, nodes, &graph).unwrap();
for node in 0..nodes {
let mut expected_parents = [0; DEGREE];
graph.parents(node as usize, &mut expected_parents).unwrap();
let parents = cache.read(node).unwrap();
assert_eq!(expected_parents, parents);
}
} | rust_cleaned_test_functions.jsonl/99639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
16372,
9698,
368,
341,
286,
1077,
7798,
284,
220,
17,
19,
84,
18,
17,
280,
286,
1077,
4771,
284,
794,
11191,
36018,
11212,
27638,
46315,
90456,
6370,
261,
6831,
931,
1261,
11191,
1006,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_resource() {
use rc::Rc;
use cell::RefCell;
struct R {
i: Rc<RefCell<int>>,
}
#[unsafe_destructor]
impl ::ops::Drop for R {
fn drop(&mut self) {
let ii = self.i.borrow();
ii.set(ii.get() + 1);
}
}
fn R(i: Rc<RefCell<int>>) -> R {
R {
i: i
}
}
let i = Rc::new(RefCell::new(0));
{
let x = R(i.clone());
let opt = Some(x);
let _y = opt.unwrap();
}
assert_eq!(i.borrow().get(), 1);
} | rust_cleaned_test_functions.jsonl/62863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
17962,
368,
341,
286,
990,
10192,
486,
49,
66,
280,
286,
990,
2779,
486,
3945,
3599,
401,
286,
2036,
431,
341,
1843,
600,
25,
81463,
27,
3945,
3599,
4159,
61340,
286,
555,
286,
11506,
38... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_server_unsupported_compiler() {
let f = TestFixture::new();
let (port, sender, server_creator, child) = run_server_thread(&f.tempdir.path(), None);
// Connect to the server.
let conn = connect_to_server(port).unwrap();
{
let mut c = server_creator.lock().unwrap();
// compiler.
c.next_command_spawns(Ok(MockChild::new(exit_status(0), "hello", "error")));
}
// Ask the server to compile something.
//TODO: MockCommand should validate these!
let exe = &f.bins[0];
let cmdline = vec!["-c".into(), "file.c".into(), "-o".into(), "file.o".into()];
let cwd = f.tempdir.path();
let client_creator = new_creator();
const COMPILER_STDOUT: &'static [u8] = b"some stdout";
const COMPILER_STDERR: &'static [u8] = b"some stderr";
{
let mut c = client_creator.lock().unwrap();
// Actual client output.
c.next_command_spawns(Ok(MockChild::new(exit_status(0), COMPILER_STDOUT, COMPILER_STDERR)));
}
let mut stdout = Cursor::new(Vec::new());
let mut stderr = Cursor::new(Vec::new());
let path = Some(f.paths);
let mut core = Core::new().unwrap();
assert_eq!(0, do_compile(client_creator.clone(), &mut core, conn, exe, cmdline, cwd, path, vec![], &mut stdout, &mut stderr).unwrap());
// Make sure we ran the mock processes.
assert_eq!(0, server_creator.lock().unwrap().children.len());
assert_eq!(0, client_creator.lock().unwrap().children.len());
assert_eq!(COMPILER_STDOUT, &stdout.into_inner()[..]);
assert_eq!(COMPILER_STDERR, &stderr.into_inner()[..]);
// Shut down the server.
sender.send(ServerMessage::Shutdown).ok().unwrap();
// Ensure that it shuts down.
child.join().unwrap();
} | rust_cleaned_test_functions.jsonl/82348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 728
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
4907,
18216,
80910,
368,
341,
262,
1077,
282,
284,
3393,
18930,
486,
931,
543,
262,
1077,
320,
403,
11,
4646,
11,
3538,
68532,
11,
1682,
8,
284,
1598,
12015,
10814,
2099,
69,
32669,
3741,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_no_append_timestamps() {
// we use timestamp as discriminant to allow repeated runs
let ts = Local::now()
.format("false-timestamps-%Y-%m-%d_%H-%M-%S")
.to_string();
let basename = String::from(DIRECTORY).add("/").add(
&Path::new(&std::env::args().next().unwrap())
.file_stem().unwrap(/*cannot fail*/)
.to_string_lossy().to_string(),
);
let naming = Naming::Timestamps;
// ensure we start with -/-/-
assert!(list_rotated_files(&basename, &ts).is_empty());
assert!(not_exists("CURRENT", &ts));
// ensure this produces -/-/ONE
write_loglines(false, naming, &ts, &[ONE]);
assert!(list_rotated_files(&basename, &ts).is_empty());
assert!(contains("CURRENT", &ts, ONE));
std::thread::sleep(std::time::Duration::from_secs(2));
// ensure this produces ONE/-/TWO
write_loglines(false, naming, &ts, &[TWO]);
assert_eq!(list_rotated_files(&basename, &ts).len(), 1);
assert!(contains("CURRENT", &ts, TWO));
std::thread::sleep(std::time::Duration::from_secs(2));
// ensure this produces ONE/TWO/THREE
write_loglines(false, naming, &ts, &[THREE]);
assert_eq!(list_rotated_files(&basename, &ts).len(), 2);
assert!(contains("CURRENT", &ts, THREE));
} | rust_cleaned_test_functions.jsonl/119666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 660
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60834,
6536,
26041,
23073,
82,
368,
341,
286,
442,
582,
990,
11441,
438,
49319,
517,
311,
2138,
11504,
8473,
198,
286,
1077,
10591,
284,
8774,
486,
3328,
741,
310,
659,
2243,
445,
3849,
2385,
47... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_watch_for() {
LAST_SIG.store(0, Ordering::SeqCst);
for _ in 0..5 {
watch_for(&[libc::SIGIO]);
assert!(check().is_ok(), "got unexpected signal");
}
} | rust_cleaned_test_functions.jsonl/58866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58562,
5478,
368,
341,
197,
15070,
6349,
55687,
16114,
7,
15,
11,
68621,
486,
20183,
34,
267,
626,
197,
2023,
716,
304,
220,
15,
496,
20,
341,
298,
6692,
754,
5478,
2099,
58,
55576,
486,
50631... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_hash() {
let mut x = BTreeSet::new();
let mut y = BTreeSet::new();
x.insert(1);
x.insert(2);
x.insert(3);
y.insert(3);
y.insert(2);
y.insert(1);
assert!(::hash(&x) == ::hash(&y));
} | rust_cleaned_test_functions.jsonl/4409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
368,
341,
220,
1077,
5206,
856,
284,
425,
6533,
1649,
486,
931,
543,
220,
1077,
5206,
379,
284,
425,
6533,
1649,
486,
931,
1428,
220,
856,
7030,
7,
16,
317,
220,
856,
7030,
7,
17,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exec_advance_pc() {
let header = make_test_header(EndianSlice::new(&[], LittleEndian));
let initial_registers = LineRow::new(&header);
let opcode = LineInstruction::AdvancePc(42);
let mut expected_registers = initial_registers;
expected_registers.address.0 += 42;
assert_exec_opcode(header, initial_registers, opcode, expected_registers, false);
} | rust_cleaned_test_functions.jsonl/3366 | {
"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,
18430,
98093,
35612,
368,
341,
286,
1077,
4247,
284,
1281,
4452,
8757,
7,
43231,
33236,
486,
931,
2099,
12995,
14671,
43231,
1106,
286,
1077,
2856,
78360,
284,
7083,
3102,
486,
931,
2099,
2708,
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_label_order() {
let v1 = VersionedCrdsValue::new(
1,
CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&solana_sdk::pubkey::new_rand(),
0,
))),
);
let v2 = VersionedCrdsValue::new(
1,
CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&solana_sdk::pubkey::new_rand(),
0,
))),
);
assert_ne!(v1, v2);
assert!(!(v1 == v2));
assert!(!(v1 < v2));
assert!(!(v1 > v2));
assert!(!(v2 < v1));
assert!(!(v2 > v1));
assert_eq!(v1.partial_cmp(&v2), None);
assert_eq!(v2.partial_cmp(&v1), None);
} | rust_cleaned_test_functions.jsonl/94345 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6106,
7869,
368,
341,
286,
1077,
348,
16,
284,
6079,
291,
16001,
5356,
1130,
486,
931,
1006,
310,
220,
16,
345,
310,
4553,
5356,
1130,
486,
931,
67830,
3025,
81,
5356,
1043,
486,
8732,
1731,
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_hunk_header() {
let parsed = parse_hunk_header("@@ -74,15 +75,14 @@ pub fn delta(\n");
let code_fragment = parsed.0;
let line_numbers_and_hunk_lengths = parsed.1;
assert_eq!(code_fragment, " pub fn delta(\n");
assert_eq!(line_numbers_and_hunk_lengths[0], (74, 15),);
assert_eq!(line_numbers_and_hunk_lengths[1], (75, 14),);
} | rust_cleaned_test_functions.jsonl/108160 | {
"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,
21039,
1523,
3122,
8757,
368,
341,
286,
1077,
15676,
284,
4715,
1523,
3122,
8757,
10662,
31,
481,
22,
19,
11,
16,
20,
488,
22,
20,
11,
16,
19,
22307,
6675,
5168,
9477,
11520,
77,
797,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_unchoke() {
let mut r = Reader::new();
r.state = State::Len;
let data = vec![0u8, 0, 0, 1, 1];
test_message(data, Message::Unchoke);
} | rust_cleaned_test_functions.jsonl/46445 | {
"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,
6443,
4907,
958,
440,
368,
341,
286,
1077,
5206,
435,
284,
25166,
486,
931,
543,
286,
435,
3467,
284,
3234,
486,
11271,
280,
286,
1077,
821,
284,
7486,
20703,
15,
84,
23,
11,
220,
15,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_request() {
let data = r#"{
"name": {
"first": "John",
"second": "Doe"
},
"age": 43,
"phones": {
"home": {
"RO": "+401234567",
"UK": "+441234567"
},
"mobile": "+442345678"
}
}"#;
MMDS.lock()
.unwrap()
.put_data(serde_json::from_str(data).unwrap())
.unwrap();
// Test invalid request.
let request = b"HTTP/1.1";
let dummy_response = Response::new(Version::Http11, StatusCode::BadRequest);
assert!(parse_request(request).status() == dummy_response.status());
// Test unsupported HTTP version.
let request = b"GET http://169.254.169.255/ HTTP/2.0\r\n\r\n";
let mut expected_response = Response::new(Version::Http11, StatusCode::NotImplemented);
expected_response.set_body(Body::new("Unsupported HTTP version.".to_string()));
let actual_response = parse_request(request);
assert!(expected_response.status() == actual_response.status());
assert!(expected_response.body().unwrap() == actual_response.body().unwrap());
assert!(expected_response.http_version() == actual_response.http_version());
let request = b"GET http:// HTTP/1.0\r\n\r\n";
let mut expected_response = Response::new(Version::Http10, StatusCode::BadRequest);
expected_response.set_body(Body::new("Invalid URI.".to_string()));
let actual_response = parse_request(request);
assert!(expected_response.status() == actual_response.status());
assert!(expected_response.body().unwrap() == actual_response.body().unwrap());
assert!(expected_response.http_version() == actual_response.http_version());
// Test invalid HTTP format.
let request = b"GET / HTTP/1.1\r\n";
let mut expected_response = Response::new(Version::Http11, StatusCode::BadRequest);
expected_response.set_body(Body::new("Invalid request.".to_string()));
let actual_response = parse_request(request);
assert!(expected_response.status() == actual_response.status());
assert!(expected_response.body().unwrap() == actual_response.body().unwrap());
assert!(expected_response.http_version() == actual_response.http_version());
// Test resource not found.
let request = b"GET http://169.254.169.254/invalid HTTP/1.0\r\n\r\n";
let mut expected_response = Response::new(Version::Http10, StatusCode::NotFound);
expected_response.set_body(Body::new("Resource not found: /invalid.".to_string()));
let actual_response = parse_request(request);
assert!(expected_response.status() == actual_response.status());
assert!(expected_response.body().unwrap() == actual_response.body().unwrap());
assert!(expected_response.http_version() == actual_response.http_version());
// Test Ok path.
let request = b"GET http://169.254.169.254/ HTTP/1.0\r\n\
Accept: application/json\r\n\r\n";
let mut expected_response = Response::new(Version::Http10, StatusCode::OK);
let mut body = r#"{
"age": 43,
"name": {
"first": "John",
"second": "Doe"
},
"phones": {
"home": {
"RO": "+401234567",
"UK": "+441234567"
},
"mobile": "+442345678"
}
}"#
.to_string();
body.retain(|c| !c.is_whitespace());
expected_response.set_body(Body::new(body));
let actual_response = parse_request(request);
assert!(expected_response.status() == actual_response.status());
assert!(expected_response.body().unwrap() == actual_response.body().unwrap());
assert!(expected_response.http_version() == actual_response.http_version());
let request = b"GET /age HTTP/1.1\r\n\r\n";
let mut expected_response = Response::new(Version::Http11, StatusCode::NotImplemented);
let body = "Cannot retrieve value. The value has an unsupported type.".to_string();
expected_response.set_body(Body::new(body));
let actual_response = parse_request(request);
assert!(expected_response.status() == actual_response.status());
assert!(expected_response.body().unwrap() == actual_response.body().unwrap());
assert!(expected_response.http_version() == actual_response.http_version());
} | rust_cleaned_test_functions.jsonl/89713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2096
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
7893,
368,
341,
286,
1077,
821,
284,
435,
55543,
515,
310,
330,
606,
788,
341,
394,
330,
3896,
788,
330,
13079,
756,
394,
330,
5569,
788,
330,
35,
4644,
698,
310,
1153,
310,
330,
424,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive() {
let b = UInt8Array::from(vec![Some(1), Some(2), Some(3)]).data();
let arrays = vec![b.as_ref()];
let mut a = MutableArrayData::new(arrays, false, 3);
a.extend(0, 0, 2);
let result = a.freeze();
let array = UInt8Array::from(Arc::new(result));
let expected = UInt8Array::from(vec![Some(1), Some(2)]);
assert_eq!(array, expected);
} | rust_cleaned_test_functions.jsonl/102334 | {
"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,
84087,
368,
341,
286,
1077,
293,
284,
22275,
23,
1857,
486,
1499,
25592,
20703,
8373,
7,
16,
701,
4329,
7,
17,
701,
4329,
7,
18,
7252,
568,
691,
543,
286,
1077,
18386,
284,
7486,
20703,
65,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_faulty_sectors_v1_1() -> Result<()> {
test_faulty_sectors_inner(fil_RegisteredSealProof::StackedDrg2KiBV1_1)
} | rust_cleaned_test_functions.jsonl/11154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70097,
88,
3453,
12532,
2273,
16,
62,
16,
368,
1464,
5714,
71698,
341,
286,
1273,
70097,
88,
3453,
12532,
34345,
87861,
62,
41430,
1514,
278,
31076,
486,
4336,
291,
35,
1984,
17,
72572,
59343,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_decoder_invalid_lone_lead_followed_by_space() {
for i in 0x80..0x100 {
let i = i as u8;
let mut d = BigFive2003Encoding.raw_decoder();
assert_feed_err!(d, [], [i], [0x20], "");
assert_finish_ok!(d, "");
}
} | rust_cleaned_test_functions.jsonl/128691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
31433,
907,
603,
87052,
43490,
291,
3710,
14663,
368,
341,
286,
369,
600,
304,
220,
15,
87,
23,
15,
496,
15,
87,
16,
15,
15,
341,
310,
1077,
600,
284,
600,
438,
575,
23,
280,
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... | 2 |
#[test]
fn test_monitor_update_fail_reestablish() {
// Simple test for message retransmission after monitor update failure on
// channel_reestablish generating a monitor update (which comes from freeing holding cell
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
create_announced_chan_between_nodes(&nodes, 1, 2, InitFeatures::known(), InitFeatures::known());
let (payment_preimage, _, _) = route_payment(&nodes[0], &[&nodes[1], &nodes[2]], 1000000);
nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
nodes[0].node.peer_disconnected(&nodes[1].node.get_our_node_id(), false);
assert!(nodes[2].node.claim_funds(payment_preimage));
check_added_monitors!(nodes[2], 1);
let mut updates = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
assert!(updates.update_fee.is_none());
assert_eq!(updates.update_fulfill_htlcs.len(), 1);
nodes[1].node.handle_update_fulfill_htlc(&nodes[2].node.get_our_node_id(), &updates.update_fulfill_htlcs[0]);
expect_payment_forwarded!(nodes[1], nodes[0], nodes[2], Some(1000), false, false);
check_added_monitors!(nodes[1], 1);
assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty());
commitment_signed_dance!(nodes[1], nodes[2], updates.commitment_signed, false);
chanmon_cfgs[1].persister.set_update_ret(Err(ChannelMonitorUpdateErr::TemporaryFailure));
nodes[0].node.peer_connected(&nodes[1].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty(), remote_network_address: None });
nodes[1].node.peer_connected(&nodes[0].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty(), remote_network_address: None });
let as_reestablish = get_event_msg!(nodes[0], MessageSendEvent::SendChannelReestablish, nodes[1].node.get_our_node_id());
let bs_reestablish = get_event_msg!(nodes[1], MessageSendEvent::SendChannelReestablish, nodes[0].node.get_our_node_id());
nodes[0].node.handle_channel_reestablish(&nodes[1].node.get_our_node_id(), &bs_reestablish);
nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &as_reestablish);
assert_eq!(
get_event_msg!(nodes[0], MessageSendEvent::SendChannelUpdate, nodes[1].node.get_our_node_id())
.contents.flags & 2, 0); // The "disabled" bit should be unset as we just reconnected
nodes[1].logger.assert_log("lightning::ln::channelmanager".to_string(), "Failed to update ChannelMonitor".to_string(), 1);
check_added_monitors!(nodes[1], 1);
nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
nodes[0].node.peer_disconnected(&nodes[1].node.get_our_node_id(), false);
nodes[0].node.peer_connected(&nodes[1].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty(), remote_network_address: None });
nodes[1].node.peer_connected(&nodes[0].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty(), remote_network_address: None });
assert!(as_reestablish == get_event_msg!(nodes[0], MessageSendEvent::SendChannelReestablish, nodes[1].node.get_our_node_id()));
assert!(bs_reestablish == get_event_msg!(nodes[1], MessageSendEvent::SendChannelReestablish, nodes[0].node.get_our_node_id()));
nodes[0].node.handle_channel_reestablish(&nodes[1].node.get_our_node_id(), &bs_reestablish);
assert_eq!(
get_event_msg!(nodes[0], MessageSendEvent::SendChannelUpdate, nodes[1].node.get_our_node_id())
.contents.flags & 2, 0); // The "disabled" bit should be unset as we just reconnected
nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &as_reestablish);
check_added_monitors!(nodes[1], 0);
assert_eq!(
get_event_msg!(nodes[1], MessageSendEvent::SendChannelUpdate, nodes[0].node.get_our_node_id())
.contents.flags & 2, 0); // The "disabled" bit should be unset as we just reconnected
chanmon_cfgs[1].persister.set_update_ret(Ok(()));
let (outpoint, latest_update, _) = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&chan_1.2).unwrap().clone();
nodes[1].chain_monitor.chain_monitor.force_channel_monitor_updated(outpoint, latest_update);
check_added_monitors!(nodes[1], 0);
updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
assert!(updates.update_fee.is_none());
assert_eq!(updates.update_fulfill_htlcs.len(), 1);
nodes[0].node.handle_update_fulfill_htlc(&nodes[1].node.get_our_node_id(), &updates.update_fulfill_htlcs[0]);
commitment_signed_dance!(nodes[0], nodes[1], updates.commitment_signed, false);
expect_payment_sent!(nodes[0], payment_preimage);
} | rust_cleaned_test_functions.jsonl/58343 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1931
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40112,
8882,
22121,
1288,
33400,
368,
341,
197,
322,
8993,
1273,
369,
1943,
312,
1458,
2728,
1283,
8718,
2647,
7901,
389,
198,
197,
322,
5496,
1288,
33400,
23163,
264,
8718,
2647,
320,
8206,
4041,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_as_json() {
test_none_with_extra(cast_string_as_json);
let mut jo1: BTreeMap<String, Json> = BTreeMap::new();
jo1.insert(String::from("a"), Json::String(String::from("b")));
// HasParseToJSONFlag
let cs = vec![
("{\"a\": \"b\"}".to_string(), Json::Object(jo1), true),
("{}".to_string(), Json::Object(BTreeMap::new()), true),
(
"[1, 2, 3]".to_string(),
Json::Array(vec![Json::I64(1), Json::I64(2), Json::I64(3)]),
true,
),
("[]".to_string(), Json::Array(Vec::new()), true),
(
"9223372036854775807".to_string(),
Json::I64(9223372036854775807),
true,
),
(
"-9223372036854775808".to_string(),
Json::I64(-9223372036854775808),
true,
),
(
"18446744073709551615".to_string(),
Json::Double(18446744073709552000.0),
true,
),
("0.0".to_string(), Json::Double(0.0), true),
(
"\"abcde\"".to_string(),
Json::String("abcde".to_string()),
true,
),
("\"\"".to_string(), Json::String("".to_string()), true),
("true".to_string(), Json::Boolean(true), true),
("false".to_string(), Json::Boolean(false), true),
];
for (input, expect, parse_to_json) in cs {
let ia = make_implicit_args(false);
let mut rft = FieldType::default();
if parse_to_json {
let fta = rft.as_mut_accessor();
fta.set_flag(FieldTypeFlag::PARSE_TO_JSON);
}
let extra = make_extra(&rft, &ia);
let result = cast_string_as_json(&extra, &Some(input.clone().into_bytes()));
let result_str = result.as_ref().map(|x| x.as_ref().map(|x| x.to_string()));
let log = format!(
"input: {}, parse_to_json: {}, expect: {:?}, result: {:?}",
input, parse_to_json, expect, result_str
);
check_result(Some(&expect), &result, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/101816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
11898,
9455,
368,
341,
286,
1273,
31488,
6615,
31858,
1337,
559,
3904,
11898,
9455,
626,
286,
1077,
5206,
7647,
16,
25,
425,
6533,
2227,
3464,
11,
8308,
29,
284,
425,
6533,
2227,
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... | 3 |
#[test]
fn test_follow_broken_symlink() {
let mut te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
te.create_broken_symlink("broken_symlink")
.expect("Failed to create broken symlink.");
te.assert_output(
&["symlink"],
"broken_symlink
symlink",
);
te.assert_output(
&["--type", "symlink", "symlink"],
"broken_symlink
symlink",
);
te.assert_output(&["--type", "file", "symlink"], "");
te.assert_output(
&["--follow", "--type", "symlink", "symlink"],
"broken_symlink",
);
te.assert_output(&["--follow", "--type", "file", "symlink"], "");
} | rust_cleaned_test_functions.jsonl/10872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43490,
880,
81709,
58530,
44243,
368,
341,
262,
1077,
5206,
1013,
284,
3393,
14359,
486,
931,
43175,
90560,
11,
11955,
48010,
317,
262,
1013,
2520,
880,
81709,
58530,
44243,
445,
48909,
58530,
44243... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_equal() {
let dna = b"ACAAAA";
let a = encode(dna);
let dnb = b"ACAAAA";
let b = encode(dnb);
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/89618 | {
"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,
11478,
368,
341,
286,
1077,
75334,
284,
293,
1,
1706,
25699,
876,
286,
1077,
264,
284,
16164,
1500,
3376,
317,
286,
1077,
294,
18080,
284,
293,
1,
1706,
25699,
876,
286,
1077,
293,
284,
16164,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_debug() -> TestResult {
let p = Polar::new();
p.load_str(indoc!(
r#"a() if debug("a") and b() and c() and d();
b();
c() if debug("c");
d();"#
))?;
let mut call_num = 0;
let debug_handler = |s: &str| {
let rt = match call_num {
0 => {
let expected = indoc!(
r#"
QUERY: debug(), BINDINGS: {}
001: a() if debug("a") and b() and c() and d();
^
002: b();
003: c() if debug("c");
004: d();
"#
);
assert_eq!(s, expected);
"over"
}
1 => {
let expected = indoc!(
r#"
QUERY: b(), BINDINGS: {}
001: a() if debug("a") and b() and c() and d();
^
002: b();
003: c() if debug("c");
004: d();
"#
);
assert_eq!(s, expected);
"over"
}
2 => {
let expected = indoc!(
r#"
QUERY: c(), BINDINGS: {}
001: a() if debug("a") and b() and c() and d();
^
002: b();
003: c() if debug("c");
004: d();
"#
);
assert_eq!(s, expected);
"over"
}
3 => {
let expected = indoc!(
r#"
QUERY: debug(), BINDINGS: {}
001: a() if debug("a") and b() and c() and d();
002: b();
003: c() if debug("c");
^
004: d();
"#
);
assert_eq!(s, expected);
"over"
}
4 => {
let expected = indoc!(
r#"
QUERY: d(), BINDINGS: {}
001: a() if debug("a") and b() and c() and d();
^
002: b();
003: c() if debug("c");
004: d();
"#
);
assert_eq!(s, expected);
"over"
}
_ => panic!("Too many calls!"),
};
call_num += 1;
rt.to_string()
};
let q = p.new_query("a()", false)?;
let _results = query_results!(q, no_results, no_externals, debug_handler);
let p = Polar::new();
p.load_str(indoc!(
r#"a() if debug() and b() and c() and d();
a() if 5 = 5;
b() if 1 = 1 and 2 = 2;
c() if 3 = 3 and 4 = 4;
d();"#
))?;
let mut call_num = 0;
let debug_handler = |s: &str| {
let rt = match call_num {
0 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: debug(), BINDINGS: {}");
"step"
}
1 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: b(), BINDINGS: {}");
"step"
}
2 => {
assert_eq!(
s.lines().next().unwrap(),
"QUERY: 1 = 1 and 2 = 2, BINDINGS: {}"
);
"out"
}
3 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: c(), BINDINGS: {}");
"step"
}
4 => {
assert_eq!(
s.lines().next().unwrap(),
"QUERY: 3 = 3 and 4 = 4, BINDINGS: {}"
);
"step"
}
5 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: 3 = 3, BINDINGS: {}");
"out"
}
6 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: d(), BINDINGS: {}");
"over"
}
7 => {
assert_eq!(s.lines().next().unwrap(), "QUERY: 5 = 5, BINDINGS: {}");
"c"
}
_ => panic!("Too many calls: {}", s),
};
call_num += 1;
rt.to_string()
};
let q = p.new_query("a()", false)?;
let _results = query_results!(q, no_results, no_externals, debug_handler);
Ok(())
} | rust_cleaned_test_functions.jsonl/97641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
55896,
486,
931,
543,
262,
281,
5104,
2895,
23884,
509,
33673,
286,
435,
55543,
64,
368,
421,
7390,
445,
64,
899,
323,
293,
368,
323,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_auth_tokens_contain_at() {
let auth_tokens = AuthTokens::new(Some("abc@123@deno.land".to_string()));
let fixture = resolve_url("https://deno.land/x/mod.ts").unwrap();
assert_eq!(
auth_tokens.get(&fixture).unwrap().to_string(),
"Bearer abc@123".to_string()
);
} | rust_cleaned_test_functions.jsonl/105824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14014,
28838,
10260,
466,
3752,
368,
341,
262,
1077,
4166,
28838,
284,
7366,
29300,
486,
931,
65405,
445,
13683,
31,
16,
17,
18,
31,
5183,
78,
87627,
3263,
983,
3904,
7392,
262,
1077,
12507,
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_floor_real() {
let cases = vec![
(3.5, 3.0),
(3.7, 3.0),
(3.45, 3.0),
(3.1, 3.0),
(-3.45, -4.0),
(-0.1, -1.0),
(16140901064495871255.0, 16140901064495871255.0),
(std::f64::MAX, std::f64::MAX),
(std::f64::MIN, std::f64::MIN),
];
for (input, expected) in cases {
let arg = Real::from(input);
let expected = Real::new(expected).ok();
let output = RpnFnScalarEvaluator::new()
.push_param(arg)
.evaluate::<Real>(ScalarFuncSig::FloorReal)
.unwrap();
assert_eq!(expected, output);
}
test_unary_func_ok_none::<Real, Real>(ScalarFuncSig::FloorReal);
} | rust_cleaned_test_functions.jsonl/37485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 499
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60044,
15266,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
18,
13,
20,
11,
220,
18,
13,
15,
1326,
310,
320,
18,
13,
22,
11,
220,
18,
13,
15,
1326,
310,
320,
18,
13,
19,
20,
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_bad_configuration_both_opts() {
let toml_str = r#"
clone_path = "/path"
repositories = [
{org = "crvshlab", name = "abc", regex = "a*"},
]
"#;
let reader = || read_bytes(toml_str.as_bytes());
let config = Configuration::read_from(reader);
assert_eq!(true, config.is_err());
} | rust_cleaned_test_functions.jsonl/76833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
35726,
88819,
32354,
368,
341,
286,
1077,
311,
1014,
2895,
284,
435,
2,
698,
310,
14715,
2638,
284,
3521,
2343,
698,
310,
49657,
284,
2278,
1060,
314,
1775,
284,
330,
5082,
85,
927,
14380... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_integer128() {
assert_ser_tokens_error(&1i128, &[], "i128 is not supported");
assert_ser_tokens_error(&1u128, &[], "u128 is not supported");
} | rust_cleaned_test_functions.jsonl/6286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31725,
16,
17,
23,
368,
341,
262,
2060,
75861,
28838,
4096,
2099,
16,
72,
16,
17,
23,
11,
609,
12995,
330,
72,
16,
17,
23,
374,
537,
7248,
3071,
262,
2060,
75861,
28838,
4096,
2099,
16,
84,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.