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_error_messages() {
let start_addr1 = GuestAddress(0x0);
let start_addr2 = GuestAddress(0x1000);
let guest_mem = GuestMemory::new(&[(start_addr1, 0x1000), (start_addr2, 0x1000)]).unwrap();
let device_manager = MMIODeviceManager::new(guest_mem, 0xd000_0000);
let mut cmdline = kernel_cmdline::Cmdline::new(4096);
let e = Error::Cmdline(
cmdline
.insert(
"virtio_mmio=device",
&format!(
"{}K@0x{:08x}:{}",
MMIO_LEN / 1024,
device_manager.mmio_base,
device_manager.irq
),
)
.unwrap_err(),
);
assert_eq!(
format!("{}", e),
"unable to add device to kernel command line: string contains an equals sign"
);
let e = Error::CloneIoEventFd(io::Error::from_raw_os_error(0));
assert_eq!(
format!("{}", e),
format!(
"failed to clone ioeventfd: {}",
io::Error::from_raw_os_error(0)
)
);
let e = Error::CloneIrqFd(io::Error::from_raw_os_error(0));
assert_eq!(
format!("{}", e),
format!("failed to clone irqfd: {}", io::Error::from_raw_os_error(0))
);
let e = Error::UpdateFailed;
assert_eq!(format!("{}", e), "failed to update the mmio device");
} | rust_cleaned_test_functions.jsonl/39603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 867
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
23428,
368,
341,
286,
1077,
1191,
7387,
16,
284,
26215,
4286,
7,
15,
87,
15,
317,
286,
1077,
1191,
7387,
17,
284,
26215,
4286,
7,
15,
87,
16,
15,
15,
15,
317,
286,
1077,
8640,
12976,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_double() {
let a = Scalar::from_repr(ScalarRepr([
0x1fff3231233ffffd,
0x4884b7fa00034802,
0x998c4fefecbc4ff3,
0x1824b159acc50562,
]))
.unwrap();
let mut b = a;
b.double();
assert_eq!(b, a + a);
} | rust_cleaned_test_functions.jsonl/56384 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
368,
341,
286,
1077,
264,
284,
35176,
486,
1499,
68535,
7,
20639,
693,
649,
8956,
310,
220,
15,
87,
16,
14092,
18,
17,
18,
16,
17,
18,
18,
7238,
67,
345,
310,
220,
15,
87,
19,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_len() {
assert_eq!("".len(), 0);
assert_eq!("hello world".len(), 11);
assert_eq!("\x63".len(), 1);
assert_eq!("\u{a2}".len(), 2);
assert_eq!("\u{3c0}".len(), 2);
assert_eq!("\u{2620}".len(), 3);
assert_eq!("\u{1d11e}".len(), 4);
assert_eq!("".chars().count(), 0);
assert_eq!("hello world".chars().count(), 11);
assert_eq!("\x63".chars().count(), 1);
assert_eq!("\u{a2}".chars().count(), 1);
assert_eq!("\u{3c0}".chars().count(), 1);
assert_eq!("\u{2620}".chars().count(), 1);
assert_eq!("\u{1d11e}".chars().count(), 1);
assert_eq!("ประเทศไทย中华Việt Nam".chars().count(), 19);
assert_eq!("hello".width(false), 10);
assert_eq!("hello".width(true), 10);
assert_eq!("\0\0\0\0\0".width(false), 0);
assert_eq!("\0\0\0\0\0".width(true), 0);
assert_eq!("".width(false), 0);
assert_eq!("".width(true), 0);
assert_eq!("\u{2081}\u{2082}\u{2083}\u{2084}".width(false), 4);
assert_eq!("\u{2081}\u{2082}\u{2083}\u{2084}".width(true), 8);
} | rust_cleaned_test_functions.jsonl/11073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 564
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6043,
368,
341,
262,
2060,
10714,
17223,
3263,
2892,
1507,
220,
15,
317,
262,
2060,
10714,
17223,
14990,
1879,
3263,
2892,
1507,
220,
16,
16,
317,
262,
2060,
10714,
0,
4921,
87,
21,
18,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_open_with_cloexec() {
let fd = Kvm::open_with_cloexec(false).unwrap();
let flags = unsafe { fcntl(fd, F_GETFD, 0) };
assert_eq!(flags & FD_CLOEXEC, 0);
let fd = Kvm::open_with_cloexec(true).unwrap();
let flags = unsafe { fcntl(fd, F_GETFD, 0) };
assert_eq!(flags & FD_CLOEXEC, FD_CLOEXEC);
} | rust_cleaned_test_functions.jsonl/127383 | {
"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,
11311,
6615,
666,
385,
11748,
368,
341,
286,
1077,
12414,
284,
730,
7338,
486,
2508,
6615,
666,
385,
11748,
3576,
568,
15454,
543,
286,
1077,
8042,
284,
19860,
314,
282,
75017,
17609,
11,
434,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vector_add_plaintext_vector() {
let (ek, dk) = test_keypair().keys();
let m1 = vec![1, 2, 3];
let c1 = Paillier::encrypt(&ek, &*m1);
let m2 = vec![3, 2, 1];
let c2 = Paillier::encrypt(&ek, &*m2);
let c = Paillier::add(&ek, &c1, &c2);
let m: Vec<_> = Paillier::decrypt(&dk, &c);
assert_eq!(m, vec![4, 4, 4]);
} | rust_cleaned_test_functions.jsonl/40393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
2891,
6317,
1641,
427,
12247,
368,
341,
286,
1077,
320,
1225,
11,
40204,
8,
284,
1273,
3097,
12670,
1005,
10563,
1428,
286,
1077,
296,
16,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_checks() {
use similar_asserts::assert_eq;
assert_eq!(PathItem::Index(0, 10).range_check(None, Some(-1)), true);
assert_eq!(PathItem::Index(9, 10).range_check(None, Some(-1)), false);
assert_eq!(PathItem::Index(0, 10).range_check(Some(1), Some(-1)), false);
assert_eq!(PathItem::Index(1, 10).range_check(Some(1), Some(-1)), true);
assert_eq!(PathItem::Index(9, 10).range_check(Some(1), Some(-1)), false);
assert_eq!(PathItem::Index(0, 10).range_check(Some(1), None), false);
assert_eq!(PathItem::Index(1, 10).range_check(Some(1), None), true);
assert_eq!(PathItem::Index(9, 10).range_check(Some(1), None), true);
} | rust_cleaned_test_functions.jsonl/80471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
75797,
368,
341,
262,
990,
4428,
16553,
82,
486,
2207,
10714,
280,
262,
2060,
10714,
10297,
1820,
1234,
486,
1552,
7,
15,
11,
220,
16,
15,
568,
9669,
7200,
26717,
11,
4329,
4080,
16,
573... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ensure_focused_line_is_visible_in_data_mode() {
let fj = parse_top_level_json(DATA_OBJECT.to_owned()).unwrap();
let mut viewer = JsonViewer::new(fj, Mode::Data);
viewer.dimensions.height = 7;
viewer.scrolloff_setting = 2;
viewer.ensure_focused_row_is_visible();
assert_eq!(viewer.top_row, 0);
// Test pushing past bottom
assert_window_tracking(
&mut viewer,
vec![
(Action::MoveDown(1), 0, 1),
(Action::MoveDown(4), 1, 6),
(Action::MoveDown(1), 2, 7),
],
);
// Test pushing past top
assert_window_tracking(
&mut viewer,
vec![
(Action::MoveUp(1), 2, 6),
(Action::MoveUp(2), 1, 3),
(Action::MoveUp(1), 0, 2),
// Top is now top of file
(Action::MoveUp(1), 0, 1),
],
);
// Test pushing past bottom at end of file
assert_window_tracking(
&mut viewer,
vec![
// Move to bottom of file
(Action::MoveDown(6), 3, 8),
// Push past bottom
(Action::MoveDown(1), 3, 9),
(Action::MoveDown(1), 3, 11),
],
);
// Put bottom of file on top of screen
viewer.top_row = 6;
viewer.focused_row = 8;
assert_window_tracking(
&mut viewer,
vec![
(Action::MoveDown(1), 6, 9),
(Action::MoveDown(1), 6, 11),
(Action::MoveUp(2), 6, 8),
(Action::MoveUp(1), 4, 7),
],
);
viewer.top_row = 0;
viewer.focused_row = 0;
viewer.dimensions.height = 5;
viewer.flatjson.collapse(2);
// Test with collapsed items
assert_window_tracking(
&mut viewer,
vec![
(Action::MoveDown(2), 0, 2),
(Action::MoveDown(1), 1, 6),
(Action::MoveDown(1), 2, 7),
(Action::MoveDown(1), 6, 8),
// Back up now
(Action::MoveUp(1), 2, 7),
(Action::MoveUp(1), 1, 6),
(Action::MoveUp(1), 0, 2),
],
);
} | rust_cleaned_test_functions.jsonl/41767 | {
"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,
62,
27289,
761,
20387,
6528,
6892,
34371,
1243,
1769,
7302,
368,
341,
286,
1077,
75371,
284,
4715,
10426,
8274,
9455,
59093,
13442,
2389,
51973,
6011,
15454,
543,
286,
1077,
5206,
25708,
284,
8308,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_name_server() {
let config = NameServerConfig {
socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(8, 8, 8, 8)), 53),
protocol: Protocol::Udp,
};
let mut io_loop = Core::new().unwrap();
let mut name_server = NameServer::<_, StandardConnection>::new(
config,
ResolverOpts::default(),
&io_loop.handle(),
);
let name = Name::parse("www.example.com.", None).unwrap();
let response = io_loop
.run(name_server.lookup(Query::query(name.clone(), RecordType::A)))
.expect("query failed");
assert_eq!(response.response_code(), ResponseCode::NoError);
} | rust_cleaned_test_functions.jsonl/104489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1269,
12015,
368,
341,
286,
1077,
2193,
284,
3988,
5475,
2648,
341,
310,
7575,
7387,
25,
20954,
13986,
486,
931,
8972,
79,
13986,
486,
53,
19,
8972,
30168,
19,
13986,
486,
931,
7,
23,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fetch_target_description_standard() {
block_on(test_fetch_target_description(
"standard/metadata".to_string(),
TargetDescription::from_reader(
"target with no custom metadata".as_bytes(),
&[HashAlgorithm::Sha256],
)
.unwrap(),
));
} | rust_cleaned_test_functions.jsonl/78739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
11123,
11448,
48688,
368,
341,
286,
2504,
4470,
8623,
11803,
11123,
11448,
1006,
310,
330,
20270,
3183,
7603,
3263,
983,
3904,
3148,
310,
13483,
5009,
486,
1499,
22306,
1006,
394,
330,
5657,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_latin_to_russian_translit_gost779b_ru_2() {
assert_eq!(
Gost779B::new(Language::Ru).from_latin(TRANSLIT_GOST779B_RU),
SOURCE_RU
);
} | rust_cleaned_test_functions.jsonl/76337 | {
"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,
907,
14768,
2346,
1710,
15579,
7965,
31635,
1889,
535,
22,
22,
24,
65,
73584,
62,
17,
368,
341,
262,
2060,
10714,
33673,
286,
479,
535,
22,
22,
24,
33,
486,
931,
83670,
486,
98625,
568,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_notify_transaction() {
let genesis_config = create_genesis_config(2).genesis_config;
let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let (transaction_status_sender, transaction_status_receiver) = unbounded();
let ledger_path = get_tmp_ledger_path!();
let blockstore =
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger");
let blockstore = Arc::new(blockstore);
let message_hash = Hash::new_unique();
let transaction = build_test_transaction_legacy();
let transaction = VersionedTransaction::from(transaction);
let transaction =
SanitizedTransaction::try_create(transaction, message_hash, Some(true), |_| {
Err(TransactionError::UnsupportedVersion)
})
.unwrap();
let expected_transaction = transaction.clone();
let pubkey = Pubkey::new_unique();
let mut nonce_account = nonce_account::create_account(1).into_inner();
let data = nonce::state::Data::new(Pubkey::new(&[1u8; 32]), Hash::new(&[42u8; 32]), 42);
nonce_account
.set_state(&nonce::state::Versions::new_current(
nonce::State::Initialized(data),
))
.unwrap();
let message = build_message();
let rollback_partial = NoncePartial::new(pubkey, nonce_account.clone());
let mut rent_debits = RentDebits::default();
rent_debits.insert(&pubkey, 123, 456);
let transaction_result =
TransactionExecutionResult::Executed(TransactionExecutionDetails {
status: Ok(()),
log_messages: None,
inner_instructions: None,
durable_nonce_fee: Some(DurableNonceFee::from(
&NonceFull::from_partial(
rollback_partial,
&SanitizedMessage::Legacy(message),
&[(pubkey, nonce_account)],
&rent_debits,
)
.unwrap(),
)),
});
let balances = TransactionBalancesSet {
pre_balances: vec![vec![123456]],
post_balances: vec![vec![234567]],
};
let owner = Pubkey::new_unique().to_string();
let pre_token_balance = TransactionTokenBalance {
account_index: 0,
mint: Pubkey::new_unique().to_string(),
ui_token_amount: token_amount_to_ui_amount(42, 2),
owner: owner.clone(),
};
let post_token_balance = TransactionTokenBalance {
account_index: 0,
mint: Pubkey::new_unique().to_string(),
ui_token_amount: token_amount_to_ui_amount(58, 2),
owner,
};
let token_balances = TransactionTokenBalancesSet {
pre_token_balances: vec![vec![pre_token_balance]],
post_token_balances: vec![vec![post_token_balance]],
};
let slot = bank.slot();
let signature = *transaction.signature();
let transaction_status_batch = TransactionStatusBatch {
bank,
transactions: vec![transaction],
execution_results: vec![transaction_result],
balances,
token_balances,
rent_debits: vec![rent_debits],
};
let test_notifier = Arc::new(RwLock::new(TestTransactionNotifier::new()));
let exit = Arc::new(AtomicBool::new(false));
let transaction_status_service = TransactionStatusService::new(
transaction_status_receiver,
Arc::new(AtomicU64::default()),
false,
Some(test_notifier.clone()),
blockstore,
&exit,
);
transaction_status_sender
.send(TransactionStatusMessage::Batch(transaction_status_batch))
.unwrap();
sleep(Duration::from_millis(500));
exit.store(true, Ordering::Relaxed);
transaction_status_service.join().unwrap();
let notifier = test_notifier.read().unwrap();
assert_eq!(notifier.notifications.len(), 1);
assert!(notifier.notifications.contains_key(&(slot, signature)));
let result = &*notifier.notifications.get(&(slot, signature)).unwrap();
assert_eq!(expected_transaction.signature(), result.1.signature());
} | rust_cleaned_test_functions.jsonl/12617 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2092
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36654,
28884,
368,
341,
286,
1077,
59366,
5332,
284,
1855,
16322,
13774,
5332,
7,
17,
568,
77894,
5332,
280,
286,
1077,
6073,
284,
19689,
486,
931,
5349,
1180,
486,
931,
6536,
50731,
20666,
5854,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_struct_ignoring_additional_fields() {
let url_params = create_url_params(vec![
("a", "1"),
("b", "true"),
("c", "abc"),
("d", "false"),
]);
assert_eq!(
Struct::deserialize(PathDeserializer::new(&url_params)).unwrap(),
Struct {
c: "abc".to_owned(),
b: true,
a: 1,
}
);
} | rust_cleaned_test_functions.jsonl/16602 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15126,
62,
622,
5503,
81742,
12132,
368,
341,
286,
1077,
2515,
6745,
284,
1855,
2903,
6745,
25592,
90515,
310,
3489,
64,
497,
330,
16,
4461,
310,
3489,
65,
497,
330,
1866,
4461,
310,
3489... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_user_ip_from_client_ip_with_auto() {
let mut event = Annotated::new(Event {
user: Annotated::new(User {
ip_address: Annotated::new(IpAddr::auto()),
..Default::default()
}),
..Default::default()
});
let mut config = StoreConfig::default();
config.client_ip = Some(IpAddr::parse("2.125.160.216").unwrap());
let geo = GeoIpLookup::open("tests/fixtures/GeoIP2-Enterprise-Test.mmdb").unwrap();
let mut processor = NormalizeProcessor::new(Arc::new(config), Some(&geo));
process_value(&mut event, &mut processor, ProcessingState::root()).unwrap();
let user = event.value().unwrap().user.value().expect("user missing");
let ip_addr = user.ip_address.value().expect("ip address missing");
assert_eq_dbg!(ip_addr, &IpAddr("2.125.160.216".to_string()));
assert!(user.geo.value().is_some());
} | rust_cleaned_test_functions.jsonl/14085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3317,
10385,
5673,
8179,
10385,
6615,
27740,
368,
341,
262,
1077,
5206,
1538,
284,
1527,
87029,
486,
931,
30469,
341,
286,
1196,
25,
1527,
87029,
486,
931,
13087,
341,
310,
5997,
6744,
25,
1527,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_updates() {
let dbname = "target/tests/testupdates";
let _ = Index::drop(dbname);
let mut index = Index::open(dbname, Some(OpenOptions::Create)).unwrap();
let mut batch = Batch::new();
let _ = index
.add(r#"{"_id":"1", "foo":"array", "baz": [1,2,[3,4,[5]]]}"#,
&mut batch)
.unwrap();
index.flush(batch).unwrap();
{
let mut results = Vec::new();
for (key, value) in index.rocks.iterator(rocksdb::IteratorMode::Start) {
if key[0] as char == 'V' {
let key_string = unsafe { str::from_utf8_unchecked(&key) }.to_string();
results.push((key_string, JsonFetcher::bytes_to_json_value(&*value)));
}
}
let expected = vec![("V1#._id".to_string(), JsonValue::String("1".to_string())),
("V1#.baz$0".to_string(), JsonValue::Number(1.0)),
("V1#.baz$1".to_string(), JsonValue::Number(2.0)),
("V1#.baz$2$0".to_string(), JsonValue::Number(3.0)),
("V1#.baz$2$1".to_string(), JsonValue::Number(4.0)),
("V1#.baz$2$2$0".to_string(), JsonValue::Number(5.0)),
("V1#.foo".to_string(), JsonValue::String("array".to_string()))];
assert_eq!(results, expected);
}
let mut batch = Batch::new();
let _ = index
.add(r#"{"_id":"1", "foo":"array", "baz": []}"#, &mut batch)
.unwrap();
index.flush(batch).unwrap();
let mut results = Vec::new();
for (key, value) in index.rocks.iterator(rocksdb::IteratorMode::Start) {
if key[0] as char == 'V' {
let key_string = unsafe { str::from_utf8_unchecked(&key) }.to_string();
results.push((key_string, JsonFetcher::bytes_to_json_value(&*value)));
}
}
let expected = vec![("V1#._id".to_string(), JsonValue::String("1".to_string())),
("V1#.baz".to_string(), JsonValue::Array(vec![])),
("V1#.foo".to_string(), JsonValue::String("array".to_string()))];
assert_eq!(results, expected);
} | rust_cleaned_test_functions.jsonl/15063 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57829,
368,
341,
286,
1077,
83492,
284,
330,
5657,
62468,
12697,
49661,
876,
286,
1077,
716,
284,
8008,
486,
6719,
9791,
606,
626,
286,
1077,
5206,
1922,
284,
8008,
486,
2508,
9791,
606,
11,
432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_json_expression_statement() {
let n = ExprStmt {
base: BaseNode::default(),
expression: Expression::StringLit(StringLit {
base: BaseNode::default(),
value: "hello".to_string(),
}),
};
let serialized = serde_json::to_string(&n).unwrap();
assert_eq!(
serialized,
r#"{"type":"ExpressionStatement","expression":{"type":"StringLiteral","value":"hello"}}"#
);
let deserialized: ExprStmt = serde_json::from_str(serialized.as_str()).unwrap();
assert_eq!(deserialized, n)
} | rust_cleaned_test_functions.jsonl/40418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
28068,
37404,
368,
341,
262,
1077,
308,
284,
28819,
31063,
341,
286,
2331,
25,
5351,
1955,
486,
2258,
3148,
286,
7493,
25,
16378,
486,
703,
68954,
2242,
68954,
341,
310,
2331,
25,
5351,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type_scope() -> Result<()> {
let url = TremorURL::parse("01/in")?;
assert_eq!(Scope::Type, url.scope());
assert_eq!(None, url.resource_type());
assert_eq!(None, url.artefact());
assert_eq!(Some("01".to_owned()), url.instance());
assert_eq!(Some("in".to_owned()), url.instance_port());
Ok(())
} | rust_cleaned_test_functions.jsonl/100909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
23199,
368,
1464,
5714,
71698,
341,
286,
1077,
2515,
284,
75163,
269,
3144,
486,
6400,
445,
15,
16,
17996,
899,
37445,
286,
2060,
10714,
10297,
10803,
486,
929,
11,
2515,
48371,
1423,
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... | 2 |
#[test]
fn test_upper() {
let result = upper(to_value("hello").unwrap(), HashMap::new());
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value("HELLO").unwrap());
} | rust_cleaned_test_functions.jsonl/49408 | {
"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,
34445,
368,
341,
286,
1077,
1102,
284,
8416,
12186,
3142,
445,
14990,
1827,
15454,
1507,
10528,
486,
931,
1423,
286,
2060,
10297,
1382,
2079,
19817,
1423,
286,
2060,
10714,
10297,
1382,
55395,
1507,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_system_assign_ix() {
let account_pubkey = Pubkey::new_unique();
let owner_pubkey = Pubkey::new_unique();
let instruction = system_instruction::assign(&account_pubkey, &owner_pubkey);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_system(
&message.instructions[0],
&AccountKeys::new(&message.account_keys, None)
)
.unwrap(),
ParsedInstructionEnum {
instruction_type: "assign".to_string(),
info: json!({
"account": account_pubkey.to_string(),
"owner": owner_pubkey.to_string(),
}),
}
);
assert!(parse_system(&message.instructions[0], &AccountKeys::new(&[], None)).is_err());
} | rust_cleaned_test_functions.jsonl/108605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
17687,
20688,
62686,
368,
341,
286,
1077,
2692,
34014,
792,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
6372,
34014,
792,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
7600,
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_esaxx_rs_long() {
let string = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.".to_string();
let chars: Vec<_> = string.chars().map(|c| c as u32).collect();
let n = chars.len();
let mut sa = vec![0; n];
let mut l = vec![0; n];
let mut r = vec![0; n];
let mut d = vec![0; n];
let alphabet_size = 0x110000; // All UCS4 range.
let node_num = esaxx_rs(&chars, &mut sa, &mut l, &mut r, &mut d, alphabet_size).unwrap();
assert_eq!(chars.len(), 574);
assert_eq!(node_num, 260);
} | rust_cleaned_test_functions.jsonl/1622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33741,
706,
87,
47115,
17799,
368,
341,
286,
1077,
914,
284,
330,
32783,
61362,
374,
4936,
17292,
1467,
315,
279,
18484,
323,
4494,
51089,
4958,
13,
46931,
61362,
702,
1012,
279,
4958,
594,
5297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sign() {
let tests = vec![
(Datum::F64(42f64), Datum::I64(1)),
(Datum::F64(0f64), Datum::I64(0)),
(Datum::F64(-47f64), Datum::I64(-1)),
(Datum::Null, Datum::Null),
];
for (arg, exp) in tests {
let got = eval_func(ScalarFuncSig::Sign, &[arg]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/13174 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
68036,
486,
37,
21,
19,
7,
19,
17,
69,
21,
19,
701,
68459,
486,
40,
21,
19,
7,
16,
6965,
310,
320,
68036,
486,
37,
21,
19,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_gt() {
for slice_2 in BIGS.windows(2) {
assert!(decimal(slice_2[1]) > decimal(slice_2[0]));
assert!(!(decimal(slice_2[0]) > decimal(slice_2[1])));
}
} | rust_cleaned_test_functions.jsonl/58106 | {
"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,
37479,
368,
341,
262,
369,
15983,
62,
17,
304,
36854,
50,
68113,
7,
17,
8,
341,
286,
2060,
10297,
23289,
75282,
62,
17,
58,
16,
2467,
861,
12122,
75282,
62,
17,
58,
15,
14382,
286,
2060,
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
] | 2 |
#[test]
fn test_name_increments() {
// name increments
let mut puffed_name = puff_string(&mut "puffed name #123".to_string(), MAX_NAME_LENGTH);
assert_eq!(puffed_name.len(), MAX_NAME_LENGTH);
increment_name(&mut puffed_name, false).unwrap();
assert_eq!(puffed_name, "puffed name #124".to_string());
let mut long_name = "aaaa bbbb cccc dddd eeee fff #14".to_string();
assert_eq!(long_name.len(), MAX_NAME_LENGTH);
increment_name(&mut long_name, false).unwrap();
assert_eq!(long_name, "aaaa bbbb cccc dddd eeee fff #15".to_string());
} | rust_cleaned_test_functions.jsonl/3936 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1269,
1243,
837,
1368,
368,
341,
286,
442,
829,
61600,
198,
286,
1077,
5206,
281,
40573,
1269,
284,
62072,
3904,
2099,
6984,
330,
79,
40573,
829,
671,
16,
17,
18,
3263,
983,
3904,
1507,
8334,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clone() {
let v: Vec<i32> = vec![];
let w = vec![1, 2, 3];
assert_eq!(v, v.clone());
let z = w.clone();
assert_eq!(w, z);
// they should be disjoint in memory.
assert!(w.as_ptr() != z.as_ptr())
} | rust_cleaned_test_functions.jsonl/24397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
368,
341,
262,
1077,
348,
25,
11312,
21897,
18,
17,
29,
284,
7486,
0,
15078,
262,
1077,
289,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
4821,
262,
2060,
10714,
10297,
85,
11,
348... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let valid = [
(1.0, 0.1),
(1.0, 1.0),
(10.0, 10.0),
(10.0, 1.0),
(10.0, INF),
];
for &arg in valid.iter() {
try_create(arg);
}
} | rust_cleaned_test_functions.jsonl/39869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
368,
341,
286,
1077,
2697,
284,
2278,
310,
320,
16,
13,
15,
11,
220,
15,
13,
16,
1326,
310,
320,
16,
13,
15,
11,
220,
16,
13,
15,
1326,
310,
320,
16,
15,
13,
15,
11,
220,
16,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_inline_in_function2() {
test(
"function baz() { var a = new obj(); result = a; }",
"function baz() { result = new obj() }",
);
} | rust_cleaned_test_functions.jsonl/27601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41871,
1243,
9174,
17,
368,
341,
262,
1273,
1006,
286,
330,
1688,
50247,
368,
314,
220,
762,
264,
284,
501,
2839,
2129,
1102,
284,
264,
26,
335,
756,
286,
330,
1688,
50247,
368,
314,
220,
1102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_eval_with_file() {
let mut file_map = HashMap::new();
file_map.insert("bar".to_owned(), Metric::Selector(BAR_SELECTOR.clone()));
file_map.insert("bar_plus_one".to_owned(), Metric::Eval("bar+1".to_owned()));
file_map.insert("oops_plus_one".to_owned(), Metric::Eval("oops+1".to_owned()));
let mut other_file_map = HashMap::new();
other_file_map.insert("bar".to_owned(), Metric::Eval("42".to_owned()));
let mut metrics = HashMap::new();
metrics.insert("bar_file".to_owned(), file_map);
metrics.insert("other_file".to_owned(), other_file_map);
let file_state =
MetricState::new(&metrics, Fetcher::FileData(BAR_99_FILE_FETCHER.clone()), None);
assert_eq!(
file_state.evaluate_variable("bar_file", variable!("bar_plus_one")),
MetricValue::Int(100)
);
require_missing(
file_state.evaluate_variable("bar_file", variable!("oops_plus_one")),
"File found nonexistent name",
);
assert_eq!(
file_state.evaluate_variable("bar_file", variable!("bar")),
MetricValue::Vector(vec![MetricValue::Int(99)])
);
assert_eq!(
file_state.evaluate_variable("other_file", variable!("bar")),
MetricValue::Int(42)
);
assert_eq!(
file_state.evaluate_variable("other_file", variable!("other_file::bar")),
MetricValue::Int(42)
);
assert_eq!(
file_state.evaluate_variable("other_file", variable!("bar_file::bar")),
MetricValue::Vector(vec![MetricValue::Int(99)])
);
require_missing(
file_state.evaluate_variable("other_file", variable!("bar_plus_one")),
"Shouldn't have found bar_plus_one in other_file",
);
require_missing(
file_state.evaluate_variable("missing_file", variable!("bar_plus_one")),
"Shouldn't have found bar_plus_one in missing_file",
);
require_missing(
file_state.evaluate_variable("bar_file", variable!("other_file::bar_plus_one")),
"Shouldn't have found other_file::bar_plus_one",
);
} | rust_cleaned_test_functions.jsonl/126958 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1056
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
6615,
2458,
368,
341,
286,
1077,
5206,
1034,
5376,
284,
10528,
486,
931,
543,
286,
1034,
5376,
7030,
445,
2257,
3263,
983,
51973,
1507,
52458,
486,
5877,
5349,
934,
72396,
15997,
7392,
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_multiple_dependencies() -> Result<(), Error> {
let child_a = ChildDecl {
name: "childA".to_string(),
url: "ignored:///child".to_string(),
startup: fsys::StartupMode::Lazy,
environment: None,
};
let child_b = ChildDecl {
name: "childB".to_string(),
url: "ignored:///child".to_string(),
startup: fsys::StartupMode::Lazy,
environment: None,
};
let child_c = ChildDecl {
name: "childC".to_string(),
url: "ignored:///child".to_string(),
startup: fsys::StartupMode::Lazy,
environment: None,
};
let decl = ComponentDecl {
offers: vec![
OfferDecl::Protocol(OfferProtocolDecl {
source: OfferServiceSource::Child("childA".to_string()),
source_path: CapabilityPath::try_from("/svc/childBOffer").unwrap(),
target_path: CapabilityPath::try_from("/svc/serviceSibling").unwrap(),
target: OfferTarget::Child("childC".to_string()),
dependency_type: DependencyType::Strong,
}),
OfferDecl::Protocol(OfferProtocolDecl {
source: OfferServiceSource::Child("childB".to_string()),
source_path: CapabilityPath::try_from("/svc/childBToC").unwrap(),
target_path: CapabilityPath::try_from("/svc/serviceSibling").unwrap(),
target: OfferTarget::Child("childC".to_string()),
dependency_type: DependencyType::Strong,
}),
],
children: vec![child_a.clone(), child_b.clone(), child_c.clone()],
..default_component_decl()
};
let mut expected: Vec<(DependencyNode, Vec<DependencyNode>)> = Vec::new();
expected.push((
DependencyNode::Child(child_b.name.clone()),
vec![DependencyNode::Child(child_c.name.clone())],
));
expected.push((
DependencyNode::Child(child_a.name.clone()),
vec![DependencyNode::Child(child_c.name.clone())],
));
expected.push((DependencyNode::Child(child_c.name.clone()), vec![]));
expected.sort_unstable();
validate_results(expected, process_component_dependencies(&decl));
Ok(())
} | rust_cleaned_test_functions.jsonl/24104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
71841,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
1682,
4306,
284,
9391,
21629,
341,
310,
829,
25,
330,
3048,
32,
3263,
983,
3904,
3148,
310,
2515,
25,
330,
58471,
60896,
3048,
326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vec_reader() {
let vec = vec![SmolStr::new(""), SmolStr::new("b")];
let s = serde_json::to_string(&vec).unwrap();
let _s: Vec<SmolStr> = serde_json::from_reader(std::io::Cursor::new(s)).unwrap();
} | rust_cleaned_test_functions.jsonl/106856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
13251,
22306,
368,
341,
286,
1077,
7486,
284,
7486,
20703,
10673,
337,
2580,
486,
931,
86076,
4388,
337,
2580,
486,
931,
445,
65,
899,
935,
286,
1077,
274,
284,
61570,
9455,
486,
983... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_correct_packet() {
let frame: Vec<u8> = vec![
0x01, 0x03, 0x00, 0x62, 0x02, 0x00, 0x8a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x39, 0x5c, 0xc7, 0x6e, 0x1a, 0xe9, 0x9f, 0xa0, 0xb1, 0x22, 0x79,
0xfe, 0xc3, 0xb9, 0xa9, 0x9e, 0x1d, 0x9a, 0x21, 0xb8, 0x47, 0x51, 0x38, 0x98, 0x25,
0xf8, 0xc7, 0xca, 0x55, 0x86, 0xbc, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x01, 0x02, 0x03,
];
let result = KeyFrameRx::parse(16, &frame[..]);
let keyframe = result.expect("parsing keyframe failed");
assert_eq!({ keyframe.eapol_fields.version }, ProtocolVersion::IEEE802DOT1X2001);
assert_eq!({ keyframe.eapol_fields.packet_type }, PacketType::KEY);
assert_eq!(keyframe.eapol_fields.packet_body_len.to_native(), 98);
assert_eq!({ keyframe.key_frame_fields.descriptor_type }, KeyDescriptor::IEEE802DOT11);
assert_eq!(keyframe.key_frame_fields.key_info(), KeyInformation(0x008a));
assert_eq!(keyframe.key_frame_fields.key_info().key_descriptor_version(), 2);
assert!(keyframe.key_frame_fields.key_info().key_ack());
assert_eq!(keyframe.key_frame_fields.key_len.to_native(), 16);
assert_eq!(keyframe.key_frame_fields.key_replay_counter.to_native(), 1);
let nonce: Vec<u8> = vec![
0x39, 0x5c, 0xc7, 0x6e, 0x1a, 0xe9, 0x9f, 0xa0, 0xb1, 0x22, 0x79, 0xfe, 0xc3, 0xb9,
0xa9, 0x9e, 0x1d, 0x9a, 0x21, 0xb8, 0x47, 0x51, 0x38, 0x98, 0x25, 0xf8, 0xc7, 0xca,
0x55, 0x86, 0xbc, 0xda,
];
assert_eq!(&keyframe.key_frame_fields.key_nonce[..], &nonce[..]);
assert_eq!(keyframe.key_frame_fields.key_rsc.to_native(), 0);
let mic = [0; 16];
assert_eq!(&keyframe.key_mic[..], mic);
let data: Vec<u8> = vec![0x01, 0x02, 0x03];
assert_eq!(&keyframe.key_data[..], &data[..]);
} | rust_cleaned_test_functions.jsonl/49825 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31550,
21078,
368,
341,
286,
1077,
4034,
25,
11312,
34837,
23,
29,
284,
7486,
90515,
310,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
21,
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_metadata_tensor_without_dataclass() {
for plugin_name in &[
plugin_names::HISTOGRAMS,
plugin_names::TEXT,
plugin_names::PR_CURVES,
plugin_names::HPARAMS,
] {
let md = blank_with_plugin_content(
plugin_name,
pb::DataClass::Unknown,
Bytes::from_static(b"preserved!"),
);
let v = SummaryValue(Box::new(Value::Tensor(pb::TensorProto {
dtype: pb::DataType::DtString.into(),
string_val: vec![Bytes::from_static(b"foo")],
..Default::default()
})));
let result = v.initial_metadata(Some(md.as_ref().clone()));
let expected = pb::SummaryMetadata {
data_class: pb::DataClass::Tensor.into(),
..*md
};
assert_eq!(*result, expected);
}
} | rust_cleaned_test_functions.jsonl/6202 | {
"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,
22220,
23188,
39904,
1769,
1040,
368,
341,
310,
369,
9006,
1269,
304,
609,
9640,
394,
9006,
9187,
486,
39,
3846,
46,
22968,
50,
345,
394,
9006,
9187,
486,
12708,
345,
394,
9006,
9187,
486,
6480,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mount_on_empty_rootfs_should_fail_and_cleanup() -> Result<(), std::io::Error> {
//use an empty rootfs for this test
let dir = TempDir::new_in("../hack/fixtures", "test")?;
let test_folder_path = dir.path().to_str().unwrap();
std::fs::create_dir(format!("{}/rootfs", &test_folder_path))?;
std::fs::copy(
"../hack/fixtures/config.json",
format!("{}/config.json", &test_folder_path),
)?;
let host_mounts_before_run_fail = MountList::new().unwrap();
let mut container = Container::new(test_folder_path, "test_folder").unwrap();
assert!(container.run().is_err());
let host_mounts_after_run_fail = MountList::new().unwrap();
assert_eq!(host_mounts_before_run_fail, host_mounts_after_run_fail);
Ok(())
} | rust_cleaned_test_functions.jsonl/126709 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57593,
4470,
15124,
12993,
3848,
43378,
22121,
8378,
42444,
368,
1464,
5714,
68843,
1460,
486,
815,
486,
1454,
29,
341,
286,
442,
810,
458,
4287,
3704,
3848,
369,
419,
1273,
198,
286,
1077,
5419,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_into_traits() {
assert_ser_tokens::<EnumToU32>(&EnumToU32::One, &[Token::Some, Token::U32(1)]);
assert_ser_tokens::<EnumToU32>(&EnumToU32::Nothing, &[Token::None]);
assert_de_tokens::<EnumToU32>(&EnumToU32::Two, &[Token::Some, Token::U32(2)]);
assert_ser_tokens::<StructFromEnum>(&StructFromEnum(Some(5)), &[Token::None]);
assert_ser_tokens::<StructFromEnum>(&StructFromEnum(None), &[Token::None]);
assert_de_tokens::<StructFromEnum>(&StructFromEnum(Some(2)), &[Token::Some, Token::U32(2)]);
} | rust_cleaned_test_functions.jsonl/58625 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
45514,
39693,
368,
341,
262,
2060,
75861,
28838,
27638,
10766,
1249,
52,
18,
17,
44784,
10766,
1249,
52,
18,
17,
486,
3966,
11,
44590,
3323,
486,
8373,
11,
9660,
486,
52,
18,
17,
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_hash() {
let hash_result = CmSketch::hash("€".as_bytes());
assert_eq!(hash_result.0, 0x59E3303A2FDD9555);
assert_eq!(hash_result.1, 0x4F9D8BB3E4BC3164);
let hash_result = CmSketch::hash("€€€€€€€€€€".as_bytes());
assert_eq!(hash_result.0, 0xCECFEB77375EEF6F);
assert_eq!(hash_result.1, 0xE9830BC26869E2C6);
} | rust_cleaned_test_functions.jsonl/19786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
368,
341,
286,
1077,
5175,
5287,
284,
356,
76,
75288,
486,
8296,
445,
15056,
3263,
300,
12524,
1423,
286,
2060,
10714,
10297,
8296,
5287,
13,
15,
11,
220,
15,
87,
20,
24,
36,
18,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert() {
let db_name = "target/tmp/test_dbu64/test_insert.abyssiniandb";
let _ = std::fs::remove_dir_all(db_name);
let db = abyssiniandb::open_file(db_name).unwrap();
let mut db_map = db
.db_map_u64_with_params(
"some_u64_1",
FileDbParams {
buckets_size: HashBucketsParam::Capacity(4),
..Default::default()
},
)
.unwrap();
assert_eq!(db_map.len().unwrap(), 0);
db_map.put(&1, &[2]).unwrap();
assert_eq!(db_map.len().unwrap(), 1);
db_map.put(&2, &[4]).unwrap();
assert_eq!(db_map.len().unwrap(), 2);
assert_eq!(db_map.get(&1).unwrap(), Some(vec![2]));
assert_eq!(db_map.get(&2).unwrap(), Some(vec![4]));
} | rust_cleaned_test_functions.jsonl/3862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
286,
1077,
2927,
1269,
284,
330,
5657,
57008,
12697,
8685,
84,
21,
19,
12697,
17678,
13,
6115,
778,
6591,
437,
65,
876,
286,
1077,
716,
284,
1460,
486,
3848,
486,
5399,
4334,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_occupied_entry_replace_entry_with() {
let mut a = HashMap::new();
let key = "a key";
let value = "an initial value";
let new_value = "a new value";
let entry = a.entry(key).insert(value).replace_entry_with(|k, v| {
assert_eq!(k, &key);
assert_eq!(v, value);
Some(new_value)
});
match entry {
Occupied(e) => {
assert_eq!(e.key(), &key);
assert_eq!(e.get(), &new_value);
}
Vacant(_) => panic!(),
}
assert_eq!(a[key], new_value);
assert_eq!(a.len(), 1);
let entry = match a.entry(key) {
Occupied(e) => e.replace_entry_with(|k, v| {
assert_eq!(k, &key);
assert_eq!(v, new_value);
None
}),
Vacant(_) => panic!(),
};
match entry {
Vacant(e) => assert_eq!(e.key(), &key),
Occupied(_) => panic!(),
}
assert!(!a.contains_key(key));
assert_eq!(a.len(), 0);
} | rust_cleaned_test_functions.jsonl/26979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 643
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
40356,
9078,
10633,
9078,
6615,
368,
341,
286,
1077,
5206,
264,
284,
10528,
486,
931,
1428,
286,
1077,
1376,
284,
330,
64,
1376,
876,
286,
1077,
897,
284,
330,
276,
2856,
897,
876,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_responds_to_keep_alive() {
let mut s = socket_established();
send!(s, TcpRepr {
seq_number: REMOTE_SEQ,
ack_number: Some(LOCAL_SEQ + 1),
..SEND_TEMPL
}, Ok(Some(TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1),
..RECV_TEMPL
})));
} | rust_cleaned_test_functions.jsonl/1784 | {
"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,
4918,
3511,
82,
2346,
50293,
58850,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
3624,
10297,
82,
11,
64876,
693,
649,
341,
310,
12981,
5500,
25,
25587,
19158,
50045,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_union() {
let mut path = Path::new();
path.add_rect(Rect::from_point_and_size((10.0, 10.0), (10.0, 10.0)), None);
let mut path2 = Path::new();
path2.add_rect(Rect::from_point_and_size((15.0, 15.0), (10.0, 10.0)), None);
let union = path.op(&path2, PathOp::Union).unwrap();
let expected: Rect = Rect::from_point_and_size((10.0, 10.0), (15.0, 15.0));
assert_eq!(union.tight_bounds().unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/47060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51621,
368,
341,
262,
1077,
5206,
1815,
284,
7933,
486,
931,
543,
262,
1815,
1364,
16979,
60083,
486,
1499,
6085,
8378,
2368,
1188,
16,
15,
13,
15,
11,
220,
16,
15,
13,
15,
701,
320,
16,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rust_builder_scope_closure() {
test_synced(move || {
use crate::Entry;
pub struct StringCallbacks {}
#[template_callbacks]
impl StringCallbacks {
#[template_callback(function)]
fn uppercase(s: &str) -> String {
skip_assert_initialized!();
s.to_uppercase()
}
}
let builder = Builder::new();
let scope = BuilderRustScope::new();
StringCallbacks::add_callbacks_to_scope_prefixed(&scope, "string_");
builder.set_scope(Some(&scope));
builder.add_from_string(CLOSURE_XML).unwrap();
let entry_a = builder.object::<Entry>("entry_a").unwrap();
let entry_b = builder.object::<Entry>("entry_b").unwrap();
entry_a.set_text("Hello World");
assert_eq!(entry_b.text().as_str(), "HELLO WORLD");
});
} | rust_cleaned_test_functions.jsonl/84769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 508
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
590,
28532,
23199,
72823,
368,
341,
286,
1273,
23008,
291,
34081,
1369,
341,
310,
990,
17717,
486,
5874,
401,
310,
6675,
2036,
923,
44461,
5613,
310,
11506,
4214,
60148,
921,
310,
11605,
923... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accountsdb_compare_two_hash_entries() {
solana_logger::setup();
let key = Pubkey::new_unique();
let hash = Hash::new_unique();
let val = CalculateHashIntermediate::new(1, hash, 1, 1, key);
let hash2 = Hash::new_unique();
let val2 = CalculateHashIntermediate::new(0, hash2, 4, 1, key);
assert_eq!(
std::cmp::Ordering::Less,
AccountsDB::compare_two_hash_entries(&val, &val2)
);
let list = vec![val.clone(), val2.clone()];
let mut list_bkup = list.clone();
list_bkup.sort_by(AccountsDB::compare_two_hash_entries);
let (list, _) = AccountsDB::sort_hash_intermediate(list);
assert_eq!(list, list_bkup);
let list = vec![val2, val.clone()]; // reverse args
let mut list_bkup = list.clone();
list_bkup.sort_by(AccountsDB::compare_two_hash_entries);
let (list, _) = AccountsDB::sort_hash_intermediate(list);
assert_eq!(list, list_bkup);
let hash3 = Hash::new_unique();
let val3 = CalculateHashIntermediate::new(1, hash3, 2, 1, key);
assert_eq!(
std::cmp::Ordering::Equal,
AccountsDB::compare_two_hash_entries(&val, &val3)
);
let hash4 = Hash::new_unique();
let val4 = CalculateHashIntermediate::new(2, hash4, 6, 1, key);
assert_eq!(
std::cmp::Ordering::Greater,
AccountsDB::compare_two_hash_entries(&val, &val4)
);
let hash5 = Hash::new_unique();
let val5 = CalculateHashIntermediate::new(0, hash5, 8, 2, key);
assert_eq!(
std::cmp::Ordering::Greater,
AccountsDB::compare_two_hash_entries(&val, &val5)
);
} | rust_cleaned_test_functions.jsonl/60847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 894
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
32235,
23241,
8950,
26092,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
1376,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
5175,
284,
6531,
486,
931,
21218,
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_remove_dbg_followed_by_block() {
check_assist(
remove_dbg,
r#"fn foo() {
if $0dbg!(x || y) {}
}"#,
r#"fn foo() {
if x || y {}
}"#,
);
check_assist(
remove_dbg,
r#"fn foo() {
while let foo = $0dbg!(&x) {}
}"#,
r#"fn foo() {
while let foo = &x {}
}"#,
);
check_assist(
remove_dbg,
r#"fn foo() {
if let foo = $0dbg!(&x) {}
}"#,
r#"fn foo() {
if let foo = &x {}
}"#,
);
check_assist(
remove_dbg,
r#"fn foo() {
match $0dbg!(&x) {}
}"#,
r#"fn foo() {
match &x {}
}"#,
);
} | rust_cleaned_test_functions.jsonl/13619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
44124,
43490,
291,
3710,
7113,
368,
341,
286,
1779,
12083,
380,
1006,
310,
4057,
44124,
345,
310,
435,
55543,
8822,
15229,
368,
341,
262,
421,
400,
15,
54318,
10297,
87,
1369,
379,
8,
561... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generic_union() {
use capnp::primitive_list;
use test_capnp::{test_generics_union, test_all_types};
let mut message = message::Builder::new_default();
{
let mut root: test_generics_union::Builder<test_all_types::Owned, primitive_list::Owned<u32>>
= message.init_root();
{
let mut bar = root.reborrow().initn_bar1(10);
bar.set(5, 100);
}
assert!(!root.has_foo1());
assert!(root.has_bar1());
assert!(!root.has_foo2());
match root.reborrow().which().unwrap() {
test_generics_union::Bar1(Ok(bar)) => {
assert_eq!(bar.len(), 10);
assert_eq!(bar.get(0), 0);
assert_eq!(bar.get(5), 100);
assert_eq!(bar.get(9), 0);
}
_ => panic!("expected Bar1"),
}
{
let mut foo = root.reborrow().init_foo2();
foo.set_int32_field(37);
}
assert!(!root.has_foo1());
assert!(!root.has_bar1());
assert!(root.has_foo2());
match root.reborrow().which().unwrap() {
test_generics_union::Foo2(Ok(foo)) => {
assert_eq!(foo.get_int32_field(), 37);
}
_ => panic!("expected Foo2"),
}
}
} | rust_cleaned_test_functions.jsonl/55856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 869
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
51621,
368,
341,
286,
990,
2062,
6199,
486,
73448,
2019,
280,
286,
990,
1273,
16388,
6199,
22964,
1944,
71963,
1211,
51621,
11,
1273,
5705,
9763,
2440,
286,
1077,
5206,
1943,
284,
1943,
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... | 3 |
#[test]
fn test_bytes_to_f64() {
let tests: Vec<(&'static [u8], f64)> = vec![
(b"", 0.0),
(b" 23", 23.0),
(b"-1", -1.0),
(b"1.11", 1.11),
(b"1.11.00", 0.0),
(b"xx", 0.0),
(b"0x00", 0.0),
(b"11.xx", 0.0),
(b"xx.11", 0.0),
];
for (v, f) in tests {
let ff = super::bytes_to_f64_without_context(v).unwrap();
if (ff - f).abs() > EPSILON {
panic!("{:?} should be decode to {}, but got {}", v, f, ff);
}
}
} | rust_cleaned_test_functions.jsonl/75520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
2346,
761,
21,
19,
368,
341,
286,
1077,
7032,
25,
11312,
27,
2099,
6,
1978,
508,
84,
23,
1125,
282,
21,
19,
16018,
284,
7486,
90515,
310,
320,
65,
56323,
220,
15,
13,
15,
1326,
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... | 3 |
#[test]
fn test_index_2() {
let mut arena: Arena<u64, &str, small_unsigned!(CAPACITY), CAPACITY> = Arena::new();
arena.add(0xD00DFEED_u64, "n/a");
let _ = &arena[1]; // OOB
} | rust_cleaned_test_functions.jsonl/120522 | {
"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,
3560,
62,
17,
368,
341,
286,
1077,
5206,
24902,
25,
27047,
34837,
21,
19,
11,
609,
495,
11,
2613,
67830,
10297,
31400,
62985,
701,
26101,
62985,
29,
284,
27047,
486,
931,
543,
286,
24902,
1364,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_panic() {
// Tests that the precondition check works
let parsed = get_tree(EX1);
let mut walk = parsed.walk();
walk.goto_first_child();
let iter = traverse(&mut walk, Order::Pre);
iter.count();
} | rust_cleaned_test_functions.jsonl/126937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
31270,
368,
341,
286,
442,
20150,
429,
279,
79438,
1779,
4278,
198,
286,
1077,
15676,
284,
633,
11663,
25409,
16,
317,
286,
1077,
5206,
4227,
284,
15676,
51394,
543,
286,
4227,
58880,
12978,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_make_github_link() {
let starship_version = "0.1.2";
let environment = Environment {
os_type: os_info::Type::Linux,
os_version: os_info::Version::semantic(1, 2, 3, Some("test".to_string())),
shell_info: ShellInfo {
name: "test_shell".to_string(),
version: "2.3.4".to_string(),
config: "No config".to_string(),
},
terminal_info: TerminalInfo {
name: "test_terminal".to_string(),
version: "5.6.7".to_string(),
},
starship_config: "No Starship config".to_string(),
};
let link = make_github_issue_link(starship_version, environment);
assert!(link.contains(starship_version));
assert!(link.contains("Linux"));
assert!(link.contains("1.2.3"));
assert!(link.contains("test_shell"));
assert!(link.contains("2.3.4"));
assert!(link.contains("No+config"));
assert!(link.contains("No+Starship+config"));
} | rust_cleaned_test_functions.jsonl/112683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 538
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
1889,
3827,
7233,
368,
341,
286,
1077,
6774,
5270,
9438,
284,
330,
15,
13,
16,
13,
17,
876,
286,
1077,
4573,
284,
11586,
341,
310,
2643,
1819,
25,
2643,
3109,
486,
929,
486,
46324,
345,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_option() {
let val = Some(1_i32);
let val = Valuable::as_value(&val);
assert!(matches!(val, Value::I32(v) if v == 1));
let val = None::<i32>;
let val = Valuable::as_value(&val);
assert!(matches!(val, Value::Unit));
} | rust_cleaned_test_functions.jsonl/89997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
368,
341,
262,
1077,
1044,
284,
4329,
7,
16,
5318,
18,
17,
317,
262,
1077,
1044,
284,
4104,
13128,
486,
300,
3142,
2099,
831,
317,
262,
2060,
10297,
19914,
10297,
831,
11,
5162,
486,
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... | 2 |
#[test]
fn test_mat_times_zero_equals_zero() {
test_cases().iter().for_each(|test| {
let a_mat_times_zero = test.a_mat * Matrix2x2::zero();
let b_mat_times_zero = test.b_mat * Matrix2x2::zero();
assert_eq!(a_mat_times_zero, Matrix2x2::zero());
assert_eq!(b_mat_times_zero, Matrix2x2::zero());
})
} | rust_cleaned_test_functions.jsonl/128957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16610,
22353,
19359,
61664,
19359,
368,
341,
286,
1273,
41427,
1005,
2015,
1005,
1958,
32046,
22428,
1944,
91,
341,
310,
1077,
264,
16610,
22353,
19359,
284,
1273,
5849,
16610,
353,
11631,
17,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_credentials_colon() {
let value = HeaderValue::from_static("Basic QWxsYWRpbg==");
let scheme = Basic::parse(&value);
assert!(scheme.is_err());
} | rust_cleaned_test_functions.jsonl/27913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
47396,
10211,
263,
368,
341,
286,
1077,
897,
284,
12104,
1130,
486,
1499,
25360,
445,
15944,
1207,
54,
18561,
56,
17925,
79,
12220,
418,
797,
286,
1077,
12859,
284,
14625,
486,
6400,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_app() {
let app = eggricesoy::app();
let matches = app.get_matches_from(["eggricesoy", "--log4rs-config", "test.yaml"]);
eggricesoy::init_logger(&matches);
} | rust_cleaned_test_functions.jsonl/122297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8191,
368,
341,
220,
1077,
906,
284,
8695,
901,
1216,
2253,
486,
676,
543,
220,
1077,
9071,
284,
906,
670,
38344,
5673,
19065,
791,
901,
1216,
2253,
497,
14482,
839,
19,
5428,
25130,
497,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_is_locked_out_sibling() {
let mut locktower = Locktower::new(EpochStakes::new_for_tests(2), 0, 0.67);
let descendants = vec![
(0, vec![1, 2].into_iter().collect()),
(1, HashSet::new()),
(2, HashSet::new()),
]
.into_iter()
.collect();
locktower.record_vote(0);
locktower.record_vote(1);
assert!(locktower.is_locked_out(2, &descendants));
} | rust_cleaned_test_functions.jsonl/25569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
60271,
6068,
96328,
368,
341,
286,
1077,
5206,
5296,
77578,
284,
15701,
77578,
486,
931,
10722,
79,
4953,
623,
2050,
486,
931,
5478,
32509,
7,
17,
701,
220,
15,
11,
220,
15,
13,
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_projective_scalar_multiplication() {
let g = G1Projective::generator();
let a = Scalar(blst::blst_fr {
l: [
to_limb(0x2b568297a56da71c),
to_limb(0xd8c39ecb0ef375d1),
to_limb(0x435c38da67bfbf96),
to_limb(0x8088a05026b659b2),
],
});
let b = Scalar(blst_fr {
l: [
to_limb(0x785fdd9b26ef8b85),
to_limb(0xc997f25837695c18),
to_limb(0x4c8dbc39e7b756c1),
to_limb(0x70d9b6cc6d87df20),
],
});
let c = a * b;
assert_eq!((g * a) * b, g * c);
} | rust_cleaned_test_functions.jsonl/10320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16352,
533,
41652,
91802,
1693,
368,
341,
286,
1077,
342,
284,
479,
16,
7849,
533,
486,
35851,
543,
286,
1077,
264,
284,
35176,
29811,
267,
486,
2024,
267,
41537,
341,
310,
326,
25,
2278,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_early_exit() {
test_interpreter_and_jit_asm!(
"
mov r0, 3
exit
mov r0, 4
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x3 } },
2
);
} | rust_cleaned_test_functions.jsonl/59006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
22140,
16880,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
15,
11,
220,
18,
198,
286,
4869,
198,
286,
1974,
435,
15,
11,
220,
19,
198,
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_cached_path_remote_file_in_subdir() {
// For debugging:
let server = MockServer::start();
// Setup cache.
let cache_dir = tempdir().unwrap();
let cache = Cache::builder()
.dir(cache_dir.path().to_owned())
.progress_bar(None)
.build()
.unwrap();
// Mock the resource.
let fixture = Fixture::load(&server, "test_fixtures/hello.txt", "fake-etag");
// Get the cached path.
let path = cache
.cached_path_with_options(&fixture.url, &Options::default().subdir("target"))
.unwrap();
assert_eq!(fixture.head.hits(), 1);
assert_eq!(fixture.get.hits(), 1);
// Ensure the file and meta exist.
assert!(path.is_file());
assert!(Meta::meta_path(&path).is_file());
} | rust_cleaned_test_functions.jsonl/38007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64369,
2638,
36425,
2458,
1243,
5228,
3741,
368,
341,
262,
442,
1752,
27703,
510,
1066,
262,
1077,
3538,
284,
14563,
5475,
486,
2468,
1428,
262,
442,
18626,
6500,
624,
262,
1077,
6500,
4334,
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_duration_as_int() {
let mut ctx = EvalContext::default();
// TODO: add more test case
let cs: Vec<(Duration, i64)> = vec![
(Duration::parse(&mut ctx, "17:51:04.78", 2).unwrap(), 175105),
(
Duration::parse(&mut ctx, "-17:51:04.78", 2).unwrap(),
-175105,
),
(Duration::parse(&mut ctx, "17:51:04.78", 0).unwrap(), 175105),
(
Duration::parse(&mut ctx, "-17:51:04.78", 0).unwrap(),
-175105,
),
];
for (input, expect) in cs {
let mut ctx = CtxConfig {
overflow_as_warning: true,
..CtxConfig::default()
}
.into();
let r = cast_any_as_any::<Duration, Int>(&mut ctx, Some(&input));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/1954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 554
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25454,
11898,
4042,
368,
341,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
2258,
543,
286,
442,
5343,
25,
912,
803,
1273,
1142,
198,
286,
1077,
10532,
25,
11312,
28706,
12945,
11,
600,
21,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_redeem_with_shares() {
let context = get_context(accounts(0));
testing_env!(context.build());
let mut contract = Shares::create(
NFT_CONTRACT_ADDRESS.into(),
NFT_TOKEN_ID.into(),
accounts(0),
TOTAL_SUPPLY.into(),
DECIMALS,
SHARE_PRICE.into()
);
contract.redeem();
// Tests
let SharesMetadata { released, .. } = contract.ft_metadata();
assert!(released);
let user_balance = contract.ft_balance_of(accounts(0));
assert!(user_balance.0 == 0);
assert!(contract.ft_total_supply().0 == 0);
} | rust_cleaned_test_functions.jsonl/21362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
450,
336,
6615,
3712,
5403,
368,
341,
286,
1077,
2266,
284,
633,
8467,
91868,
7,
15,
1106,
286,
7497,
15879,
10297,
2147,
13239,
5231,
286,
1077,
5206,
5116,
284,
44185,
486,
3182,
1006,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_max_funding_satoshis() {
assert!(MAX_FUNDING_SATOSHIS <= 21_000_000 * 100_000_000,
"MAX_FUNDING_SATOSHIS is greater than all satoshis in existence");
} | rust_cleaned_test_functions.jsonl/15099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
761,
37189,
51303,
9267,
285,
368,
341,
197,
6948,
10297,
10586,
1400,
13205,
1718,
1098,
828,
86188,
1637,
2651,
220,
17,
16,
62,
15,
15,
15,
62,
15,
15,
15,
353,
220,
16,
15,
15,
62,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_ixdyn() {
let a = <Array<f32, IxDyn> as Default>::default();
let b = <Array<f32, _>>::zeros(IxDyn(&[0]));
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/92633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
62686,
43085,
368,
341,
262,
1077,
264,
284,
366,
1857,
63895,
18,
17,
11,
358,
15764,
1872,
29,
438,
7899,
6831,
2258,
543,
262,
1077,
293,
284,
366,
1857,
63895,
18,
17,
11,
716,
77595... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_creation() {
let db = Database::temp().unwrap();
let config = Config::default();
let ctx = ActionsCtx::new(&db, &config);
crate::crates::lists::setup_test_lists(&db, &config).unwrap();
let api_url = "https://api.github.com/repos/example/example/issues/10";
let html_url = "https://github.com/example/example/issue/10";
CreateExperiment {
name: "foo".to_string(),
toolchains: [MAIN_TOOLCHAIN.clone(), TEST_TOOLCHAIN.clone()],
mode: Mode::BuildAndTest,
crates: CrateSelect::Local,
cap_lints: CapLints::Forbid,
priority: 5,
github_issue: Some(GitHubIssue {
api_url: api_url.to_string(),
html_url: html_url.to_string(),
number: 10,
}),
ignore_blacklist: true,
assign: None,
requirement: Some("linux".to_string()),
}
.apply(&ctx)
.unwrap();
let ex = Experiment::get(&db, "foo").unwrap().unwrap();
assert_eq!(ex.name.as_str(), "foo");
assert_eq!(
ex.toolchains,
[MAIN_TOOLCHAIN.clone(), TEST_TOOLCHAIN.clone()]
);
assert_eq!(ex.mode, Mode::BuildAndTest);
assert_eq!(
ex.get_crates(&ctx.db).unwrap(),
crate::crates::lists::get_crates(&CrateSelect::Local, &db, &config).unwrap()
);
assert_eq!(ex.cap_lints, CapLints::Forbid);
assert_eq!(ex.github_issue.as_ref().unwrap().api_url.as_str(), api_url);
assert_eq!(
ex.github_issue.as_ref().unwrap().html_url.as_str(),
html_url
);
assert_eq!(ex.github_issue.as_ref().unwrap().number, 10);
assert_eq!(ex.priority, 5);
assert_eq!(ex.status, Status::Queued);
assert!(ex.assigned_to.is_none());
assert!(ex.ignore_blacklist);
assert_eq!(ex.requirement, Some("linux".to_string()));
} | rust_cleaned_test_functions.jsonl/74498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1026
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46163,
368,
341,
286,
1077,
2927,
284,
9994,
486,
3888,
1005,
15454,
543,
286,
1077,
2193,
284,
5532,
486,
2258,
543,
286,
1077,
5635,
284,
26722,
23684,
486,
931,
2099,
1999,
11,
609,
1676,
626... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_directions() {
assert_eq!(Direction::from_str("N").unwrap(), Direction::North);
assert_eq!(
Direction::from_str("NNE").unwrap(),
Direction::NorthNorthEast
);
assert_eq!(Direction::from_str("NE").unwrap(), Direction::NorthEast);
assert_eq!(
Direction::from_str("ENE").unwrap(),
Direction::EastNorthEast
);
assert_eq!(Direction::from_str("E").unwrap(), Direction::East);
assert_eq!(
Direction::from_str("ESE").unwrap(),
Direction::EastSouthEast
);
assert_eq!(Direction::from_str("SE").unwrap(), Direction::SouthEast);
assert_eq!(
Direction::from_str("SSE").unwrap(),
Direction::SouthSouthEast
);
assert_eq!(Direction::from_str("S").unwrap(), Direction::South);
assert_eq!(
Direction::from_str("SSW").unwrap(),
Direction::SouthSouthWest
);
assert_eq!(Direction::from_str("SW").unwrap(), Direction::SouthWest);
assert_eq!(
Direction::from_str("WSW").unwrap(),
Direction::WestSouthWest
);
assert_eq!(Direction::from_str("W").unwrap(), Direction::West);
assert_eq!(
Direction::from_str("WNW").unwrap(),
Direction::WestNorthWest
);
assert_eq!(Direction::from_str("NW").unwrap(), Direction::NorthWest);
assert_eq!(
Direction::from_str("NNW").unwrap(),
Direction::NorthNorthWest
);
} | rust_cleaned_test_functions.jsonl/100930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 761
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25438,
82,
368,
341,
286,
2060,
10714,
10297,
9268,
486,
1499,
2895,
445,
45,
1827,
15454,
1507,
18904,
486,
25221,
317,
286,
2060,
10714,
33673,
310,
18904,
486,
1499,
2895,
445,
45,
3944,
1827,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookup() {
let mut handlebars = Registry::new();
assert!(handlebars
.register_template_string("t0", "{{#each v1}}{{lookup ../../v2 @index}}{{/each}}")
.is_ok());
assert!(handlebars
.register_template_string("t1", "{{#each v1}}{{lookup ../../v2 1}}{{/each}}")
.is_ok());
assert!(handlebars
.register_template_string("t2", "{{lookup kk \"a\"}}")
.is_ok());
let mut m: BTreeMap<String, Vec<u16>> = BTreeMap::new();
m.insert("v1".to_string(), vec![1u16, 2u16, 3u16]);
m.insert("v2".to_string(), vec![9u16, 8u16, 7u16]);
let m2 = btreemap! {
"kk".to_string() => btreemap!{"a".to_string() => "world".to_string()}
};
let r0 = handlebars.render("t0", &m);
assert_eq!(r0.ok().unwrap(), "987".to_string());
let r1 = handlebars.render("t1", &m);
assert_eq!(r1.ok().unwrap(), "888".to_string());
let r2 = handlebars.render("t2", &m2);
assert_eq!(r2.ok().unwrap(), "world".to_string());
} | rust_cleaned_test_functions.jsonl/79614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 572
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
368,
341,
286,
1077,
5206,
3705,
24950,
284,
32112,
486,
931,
543,
286,
2060,
10297,
8192,
24950,
198,
310,
659,
6343,
8693,
3904,
445,
83,
15,
497,
47219,
2,
9547,
348,
16,
77286,
21020,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_file_list_recursive_with_dir() -> Result<()> {
let gh_token = env::github_token(&None::<String>)?;
let file_list = get_file_list_recursive(&gh_token, "suecharo", "gh-trs", "src", "main")?;
assert!(file_list.contains(&PathBuf::from("src/main.rs")));
Ok(())
} | rust_cleaned_test_functions.jsonl/6708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2458,
2019,
66242,
6615,
4334,
368,
1464,
5714,
71698,
341,
286,
1077,
36124,
6458,
284,
6105,
486,
5204,
6458,
2099,
4064,
27638,
703,
9231,
37445,
286,
1077,
1034,
2019,
284,
633,
2458,
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... | 3 |
#[test]
fn test_dim_compact_string_duplicate_definition() {
let program = r#"
DIM A$
DIM A$
"#;
assert_linter_err!(program, QError::DuplicateDefinition, 3, 17);
} | rust_cleaned_test_functions.jsonl/122457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10791,
18177,
531,
3904,
70434,
31698,
368,
341,
262,
1077,
2025,
284,
435,
2,
698,
310,
50859,
362,
25046,
310,
50859,
362,
25046,
310,
5869,
280,
262,
2060,
907,
2245,
9266,
10297,
14906,
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 |
#[test]
fn test_static_str() {
assert_eq!(Binary::from("test").len(), 4);
assert_eq!(Binary::from("test").as_ref(), b"test");
} | rust_cleaned_test_functions.jsonl/88996 | {
"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,
25360,
2895,
368,
341,
286,
2060,
10714,
10297,
21338,
486,
1499,
445,
1944,
1827,
2892,
1507,
220,
19,
317,
286,
2060,
10714,
10297,
21338,
486,
1499,
445,
1944,
1827,
300,
7793,
1507,
293,
1,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_decr_int() {
assert_eq!(decr_int(&["./argparse_test"]), 5);
assert_eq!(decr_int(&["./argparse_test", "--decr"]), 4);
assert_eq!(decr_int(&["./argparse_test", "-dddddd"]), -1);
} | rust_cleaned_test_functions.jsonl/125751 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
5082,
4042,
368,
341,
262,
2060,
10714,
10297,
450,
5082,
4042,
2099,
1183,
1725,
858,
6400,
4452,
63624,
220,
20,
317,
262,
2060,
10714,
10297,
450,
5082,
4042,
2099,
1183,
1725,
858,
6400,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_218() {
assert_eq!(
Solution::find_itinerary(vec![
vec!["MUC".to_string(), "LHR".to_string()],
vec!["JFK".to_string(), "MUC".to_string()],
vec!["SFO".to_string(), "SJC".to_string()],
vec!["LHR".to_string(), "SFO".to_string()],
]),
vec![
"JFK".to_string(), "MUC".to_string(), "LHR".to_string(),
"SFO".to_string(), "SJC".to_string()
]
);
assert_eq!(
Solution::find_itinerary(vec![
vec!["JFK".to_string(), "SFO".to_string()],
vec!["JFK".to_string(), "ATL".to_string()],
vec!["SFO".to_string(), "ATL".to_string()],
vec!["ATL".to_string(), "JFK".to_string()],
vec!["ATL".to_string(), "SFO".to_string()],
]),
vec![
"JFK".to_string(), "ATL".to_string(), "JFK".to_string(),
"SFO".to_string(), "ATL".to_string(), "SFO".to_string()
]
);
} | rust_cleaned_test_functions.jsonl/32437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 649
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
16,
23,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
3903,
14631,
51553,
25592,
90515,
394,
7486,
0,
1183,
44,
5459,
3263,
983,
3904,
1507,
330,
43,
17088,
3263,
983,
3904,
73845,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fold_bang_constants() {
fold("1 + !0", "2");
fold("1 + !1", "1");
fold("'a ' + !1", "'a false'");
fold("'a ' + !0", "'a true'");
} | rust_cleaned_test_functions.jsonl/122219 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
880,
524,
55642,
368,
341,
262,
11555,
445,
16,
488,
753,
15,
497,
330,
17,
797,
262,
11555,
445,
16,
488,
753,
16,
497,
330,
16,
797,
262,
11555,
45456,
64,
364,
488,
753,
16,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_iterate_into_string() {
let words = vec!["hello", " ", "world"];
let capitalized_words: String = words.into_iter().map(|w| capitalize_first(w)).collect();
assert_eq!(capitalized_words, "Hello World");
} | rust_cleaned_test_functions.jsonl/70636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
45514,
3904,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
3670,
330,
14615,
6332,
286,
1077,
97321,
18981,
25,
923,
284,
4244,
39860,
11723,
1005,
2186,
22428,
86,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_hex_literal2() {
let s = to_chars("hex\"ZZZZ\"");
let cur = &mut 0;
expect_next_token(&s, cur, Token::Illegal);
} | rust_cleaned_test_functions.jsonl/21060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32655,
34100,
17,
368,
341,
286,
1077,
274,
284,
311,
37418,
445,
17308,
2105,
33536,
33536,
88385,
286,
1077,
2847,
284,
609,
6984,
220,
15,
280,
286,
1720,
11257,
6458,
2099,
82,
11,
2847,
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 |
#[test]
fn test_kmers_too_short() {
let dna = "TGCATTAGAA".to_string();
let dna_string = DnaString::from_dna_string(&dna);
let kmers: Vec<IntKmer<u64>> = dna_string.iter_kmers().collect();
assert_eq!(kmers, vec![]);
} | rust_cleaned_test_functions.jsonl/95217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
22780,
2346,
78,
16673,
368,
341,
286,
1077,
75334,
284,
330,
51,
22863,
21614,
1890,
6029,
3263,
983,
3904,
543,
286,
1077,
75334,
3904,
284,
422,
3376,
703,
486,
1499,
814,
3376,
3904,
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_error_codes() {
settings::set_defaults();
settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE, "false");
settings::set_config_value(settings::CONFIG_WALLET_KEY, settings::TEST_WALLET_KEY);
delete_indy_client();
create_genesis_txn_file();
let vcx_config = provision_agent().unwrap();
init_vcx(&vcx_config).unwrap();
vcx_shutdown(false);
assert_eq!(provision_agent().err(), Some(error::DID_ALREADY_EXISTS_IN_WALLET.code_num));
vcx_shutdown(true);
} | rust_cleaned_test_functions.jsonl/66790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
38482,
368,
341,
286,
5003,
486,
746,
42290,
543,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
14379,
11641,
8414,
11,
330,
3849,
797,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
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_verify_4() {
let password = "^T5H$JYt39n%K*j:W]!1s?vg!:jGi]Ax?..l7[p0v:1jHTpla9;]bUN;?bWyCbtqg ";
let out = "$argon2id$v=19$m=4096,t=0,p=1$PkEgMTYtYnl0ZXMgc2FsdA$ltB/ue1kPtBMBGfsysMpPigE6hiNEKZ9vs8vLNVDQGA";
let hashed = to_hashed_password(out);
assert!(
!pwhash_verify(&hashed, password.as_bytes()),
"should have failed to verify"
);
} | rust_cleaned_test_functions.jsonl/134475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
62,
19,
368,
341,
286,
1077,
3552,
284,
39915,
51,
20,
39,
3,
41,
56,
83,
18,
24,
77,
4,
42,
54045,
25,
54,
60,
0,
16,
82,
30,
7239,
35575,
73,
46841,
60,
37842,
30,
496,
75,
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_delete_node_checks() {
let mut data = Data::new();
assert!(data.apply(&delete_node!(id: 0)).is_err());
let mut data = Data::new();
data.apply(&create_node!(parent: 0, id: 1, name: "first")).ok();
assert!(data.apply(&delete_node!(id: 1)).is_ok());
assert!(data.apply(&delete_node!(id: 1)).is_err());
} | rust_cleaned_test_functions.jsonl/10367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
5084,
75797,
368,
341,
286,
1077,
5206,
821,
284,
2885,
486,
931,
543,
286,
2060,
10297,
691,
13045,
2099,
4542,
5084,
10297,
307,
25,
220,
15,
4579,
285,
9266,
1423,
286,
1077,
5206,
821... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_abrirllave() {
assert_eq!(abrirllave("{"), Ok(("", "{")));
assert_eq!(
abrirllave("a"),
Err(NomErr::Error(VerboseError {
errors: vec![
("a", VerboseErrorKind::Nom(ErrorKind::Tag)),
("a", VerboseErrorKind::Context("abrirllave")),
]
}))
);
} | rust_cleaned_test_functions.jsonl/17451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22885,
37215,
654,
523,
368,
341,
286,
2060,
10714,
10297,
370,
37215,
654,
523,
13976,
3975,
7622,
7,
19814,
13868,
17621,
286,
2060,
10714,
33673,
310,
72563,
654,
523,
445,
64,
4461,
310,
15495... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quoted_emote() {
let mut args = Arguments::new(r#"omg "😕 - 😟" kewl"#);
assert_eq!(Some("omg"), args.next());
assert_eq!(Some("😕 - 😟"), args.next());
assert_eq!(Some("kewl"), args.next());
assert_eq!(None, args.next());
} | rust_cleaned_test_functions.jsonl/53187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
9253,
22504,
1272,
368,
341,
286,
1077,
5206,
2827,
284,
27702,
486,
931,
2601,
55543,
316,
70,
330,
145491,
481,
26525,
253,
1,
595,
365,
75,
57676,
317,
286,
2060,
10714,
10297,
8373,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flags_from_vec_9() {
let (flags, subcommand, argv) = flags_from_vec(svec![
"deno",
"run",
"--allow-high-precision",
"script.ts"
]);
assert_eq!(
flags,
DenoFlags {
allow_high_precision: true,
..DenoFlags::default()
}
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(argv, svec!["deno", "script.ts"]);
} | rust_cleaned_test_functions.jsonl/115785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14130,
5673,
13251,
62,
24,
368,
341,
262,
1077,
320,
11161,
11,
1186,
5631,
11,
10213,
8,
284,
8042,
5673,
13251,
1141,
4083,
90515,
414,
330,
5183,
78,
756,
414,
330,
6108,
756,
414,
14482,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_kernel_phsize() {
// program header has to be past the end of the elf header
let gm = create_guest_mem();
let mut bad_image = make_test_bin();
bad_image[0x36] = 0x10;
assert_eq!(
Err(Error::InvalidProgramHeaderSize),
load_kernel(&gm, &mut Cursor::new(&bad_image), 0)
);
} | rust_cleaned_test_functions.jsonl/88248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
26876,
9782,
2141,
368,
341,
286,
442,
2025,
4247,
702,
311,
387,
3267,
279,
835,
315,
279,
40745,
4247,
198,
286,
1077,
37879,
284,
1855,
62739,
12976,
543,
286,
1077,
5206,
3873,
4954,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_protocol() {
let tcp = to_protocol(netfilter::SocketProtocol::Tcp);
assert_eq!(tcp.unwrap(), netconfig::Protocol::Tcp);
let udp = to_protocol(netfilter::SocketProtocol::Udp);
assert_eq!(udp.unwrap(), netconfig::Protocol::Udp);
let icmpv6 = to_protocol(netfilter::SocketProtocol::Icmpv6);
assert_eq!(icmpv6.is_none(), true);
} | rust_cleaned_test_functions.jsonl/52754 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
34880,
368,
341,
286,
1077,
28051,
284,
311,
34880,
30723,
5315,
486,
10286,
20689,
486,
77536,
317,
286,
2060,
10714,
10297,
27161,
55395,
1507,
4179,
1676,
486,
20689,
486,
77536,
626,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repairman_catchup() {
solana_logger::setup();
error!("test_repairman_catchup");
run_repairman_catchup(3);
} | rust_cleaned_test_functions.jsonl/55981 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 64
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
12670,
1515,
666,
754,
454,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
543,
262,
1465,
17223,
1944,
1288,
12670,
1515,
666,
754,
454,
797,
262,
1598,
1288,
12670,
1515,
666,
754,
454,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vec_list_debug() {
let mut list = VecList::new();
list.push_back(0);
list.push_back(1);
list.push_back(-1);
list.push_back(2);
list.push_back(-2);
assert_eq!(format!("{:?}", list), "[0, 1, -1, 2, -2]");
} | rust_cleaned_test_functions.jsonl/11518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2019,
15446,
368,
341,
286,
1077,
5206,
1140,
284,
11312,
852,
486,
931,
543,
286,
1140,
2552,
3895,
7,
15,
317,
286,
1140,
2552,
3895,
7,
16,
317,
286,
1140,
2552,
3895,
4080,
16,
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_packages_sorted() {
let mock_reader = Box::new(MockPackageReader::new());
let (_, model) = create_model();
let mut targets = HashMap::new();
targets.insert(
String::from("123"),
FarPackageDefinition { custom: Custom { merkle: String::from("123") } },
);
targets.insert(
String::from("456"),
FarPackageDefinition { custom: Custom { merkle: String::from("456") } },
);
mock_reader.append_target(TargetsJson { signed: Signed { targets: targets } });
let sb_0 = create_test_sandbox(vec![String::from("fuchsia.test.foo")]);
let cms_0 = create_test_cmx_map(vec![(String::from("meta/foo.cmx"), sb_0)]);
let pkg_0 =
create_test_package_with_cms(String::from("fuchsia-pkg://fuchsia.com/foo"), cms_0);
mock_reader.append_pkg_def(pkg_0);
let sb_1 = create_test_sandbox(vec![String::from("fuchsia.test.bar")]);
let cms_1 = create_test_cmx_map(vec![(String::from("meta/bar.cmx"), sb_1)]);
let pkg_1 =
create_test_package_with_cms(String::from("fuchsia-pkg://fuchsia.com/bar"), cms_1);
mock_reader.append_pkg_def(pkg_1);
let collector = PackageDataCollector::default();
let package_reader: Box<dyn PackageReader> = mock_reader;
let package_getter: Box<dyn PackageGetter> = Box::new(MockPackageGetter::new());
collector.collect_with_reader(package_reader, package_getter, Arc::clone(&model)).unwrap();
// Test that the packages are in sorted order.
let packages = &model.get::<Packages>().unwrap().entries;
assert_eq!(packages.len(), 2);
assert_eq!(packages[0].url, "fuchsia-pkg://fuchsia.com/bar");
assert_eq!(packages[1].url, "fuchsia-pkg://fuchsia.com/foo");
} | rust_cleaned_test_functions.jsonl/19467 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 825
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41874,
41277,
368,
341,
286,
1077,
7860,
22306,
284,
8261,
486,
931,
66436,
13100,
5062,
486,
931,
1423,
286,
1077,
39464,
1614,
8,
284,
1855,
5047,
1428,
286,
1077,
5206,
11550,
284,
10528,
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_init_fails_with_open_wallet() {
let wallet_name = "test_init_fails_with_open_wallet";
::utils::devsetup::tests::setup_ledger_env(wallet_name);
let config_path = "/tmp/test_init.json";
let content = create_config_util(wallet_name, settings::TEST_WALLET_KEY);
settings::write_config_to_file(&content, config_path).unwrap();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init(cb.command_handle,
CString::new(config_path).unwrap().into_raw(),
Some(cb.get_callback())),
error::ALREADY_INITIALIZED.code_num);
// Don't Leave file around or other concurrent tests will fail
::utils::devsetup::tests::cleanup_dev_env(wallet_name);
} | rust_cleaned_test_functions.jsonl/19804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
761,
6209,
6615,
11311,
62308,
368,
341,
286,
1077,
15085,
1269,
284,
330,
1944,
6137,
761,
6209,
6615,
11311,
62308,
876,
286,
3504,
6031,
486,
3583,
15188,
486,
23841,
486,
15188,
38367,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_skiplist10() {
// checking that void gets serialized to nothing.
let mut output: Vec<u8> = Vec::new();
let mut skip_list_builder: SkipListBuilder<()> = SkipListBuilder::new(4);
for i in 0..((4 * 4 * 4) - 1) {
skip_list_builder.insert(i, &()).unwrap();
}
skip_list_builder.write::<Vec<u8>>(&mut output).unwrap();
assert_eq!(output.len(), 230);
assert_eq!(output[0], 128u8 + 3u8);
} | rust_cleaned_test_functions.jsonl/65083 | {
"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,
643,
6642,
39934,
16,
15,
368,
341,
286,
442,
13295,
429,
737,
5221,
32916,
311,
4302,
624,
286,
1077,
5206,
2550,
25,
11312,
34837,
23,
29,
284,
11312,
486,
931,
543,
286,
1077,
5206,
10706,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_formatting_registry_url() {
assert_eq!(
format_registry_url(
&default_raze_settings_registry(),
&"foo".to_string(),
&"0.0.1".to_string()
),
"https://crates.io/api/v1/crates/foo/0.0.1/download"
);
assert_eq!(
format_registry_url(
&"https://registry.io/{crate}/{crate}/{version}/{version}".to_string(),
&"foo".to_string(),
&"0.0.1".to_string()
),
"https://registry.io/foo/foo/0.0.1/0.0.1"
);
} | rust_cleaned_test_functions.jsonl/37372 | {
"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,
8955,
1280,
50650,
2903,
368,
341,
262,
2060,
10714,
33673,
414,
3561,
50650,
2903,
1006,
286,
609,
2258,
59969,
2986,
10853,
50650,
3148,
286,
609,
1,
7975,
3263,
983,
3904,
3148,
286,
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... | 1 |
#[test]
fn test_formatting() {
let array = ["eenie", "meenie", "minie", "moe"];
let formatter = crate::UListFormatter::try_new("en-US").expect("has list format");
let result = formatter.format(&array).expect("formatting succeeds");
assert_eq!("eenie, meenie, minie, and moe", result);
} | rust_cleaned_test_functions.jsonl/126134 | {
"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,
8955,
1280,
368,
341,
286,
1077,
1334,
284,
4383,
14911,
645,
497,
330,
2660,
61558,
497,
330,
1065,
645,
497,
330,
76,
4644,
6332,
286,
1077,
24814,
284,
17717,
486,
52,
852,
14183,
486,
1539,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_batch() {
let (control_tx, control_fsm) = new_runner(10);
let (router, mut system) = super::create_system(2, 2, control_tx, control_fsm);
let builder = Builder {
metrics: Arc::default(),
router: router.clone(),
};
let metrics = builder.metrics.clone();
system.spawn("test".to_owned(), builder);
let mut expected_metrics = HandleMetrics::default();
assert_eq!(*metrics.lock().unwrap(), expected_metrics);
let (tx, rx) = mpsc::unbounded();
let tx_ = tx.clone();
let r = router.clone();
router
.send_control(Box::new(move |_: &mut Runner| {
let (tx, runner) = new_runner(10);
let mailbox = BasicMailbox::new(tx, runner);
tx_.send(1).unwrap();
r.register(1, mailbox);
}))
.unwrap();
assert_eq!(rx.recv_timeout(Duration::from_secs(3)), Ok(1));
let tx_ = tx.clone();
router
.send(
1,
Box::new(move |_: &mut Runner| {
tx_.send(2).unwrap();
}),
)
.unwrap();
assert_eq!(rx.recv_timeout(Duration::from_secs(3)), Ok(2));
system.shutdown();
expected_metrics.control = 1;
expected_metrics.normal = 1;
expected_metrics.begin = 2;
assert_eq!(*metrics.lock().unwrap(), expected_metrics);
} | rust_cleaned_test_functions.jsonl/58871 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 776
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
368,
341,
286,
1077,
320,
2865,
17805,
11,
2524,
97069,
8,
284,
501,
54828,
7,
16,
15,
317,
286,
1077,
320,
9937,
11,
5206,
1849,
8,
284,
2256,
486,
3182,
17687,
7,
17,
11,
220,
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_padding_2() {
padding_impl_2("a", &[1, 24, 24, 24, 24]);
padding_impl_2("abcde", &[1, 2, 3, 4, 5]);
padding_impl_2(".", &[]);
padding_impl_2("abcdef", &[1, 2, 3, 4, 5, 6, 24, 24, 24, 24]);
padding_impl_2("a.b.c.d", &[1, 2, 3, 4, 24]);
padding_impl_2("", &[]);
} | rust_cleaned_test_functions.jsonl/108452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40726,
62,
17,
368,
341,
286,
5300,
21007,
62,
17,
445,
64,
497,
44590,
16,
11,
220,
17,
19,
11,
220,
17,
19,
11,
220,
17,
19,
11,
220,
17,
19,
2558,
286,
5300,
21007,
62,
17,
445,
13683... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scope_eval() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
// First create the state
let mut scope = Scope::new();
// Then push some initialized variables into the state
// NOTE: Remember the default numbers used by Rhai are INT and f64.
// Better stick to them or it gets hard to work with other variables in the script.
scope.push("y", 42 as INT);
scope.push("z", 999 as INT);
// First invocation
engine
.eval_with_scope::<()>(&mut scope, " let x = 4 + 5 - y + z; y = 1;")
.expect("y and z not found?");
// Second invocation using the same state
let result = engine.eval_with_scope::<INT>(&mut scope, "x")?;
println!("result: {}", result); // should print 966
// Variable y is changed in the script
assert_eq!(
scope
.get_value::<INT>("y")
.expect("variable y should exist"),
1
);
Ok(())
} | rust_cleaned_test_functions.jsonl/25276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23199,
21296,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
442,
5512,
1855,
279,
1584,
198,
262,
1077,
5206,
6891,
284,
34920,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_long_redirection_to_root() {
// Create a 255-character path to root
let dir = path_concat!("..", ..85);
new_ucmd!()
.arg("-n")
.arg("-m")
.arg(dir)
.run()
.stdout_is(get_root_path());
} | rust_cleaned_test_functions.jsonl/37404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
26058,
2866,
2346,
12993,
368,
341,
262,
442,
4230,
264,
220,
17,
20,
20,
79225,
1815,
311,
3704,
198,
262,
1077,
5419,
284,
1815,
57478,
17223,
496,
497,
5241,
23,
20,
317,
262,
501,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rom_already_multiple_of() {
let mut rom = vec![0; 12 * 1024 * 1024];
pad_rom(&mut rom);
assert_eq!(vec![0; 12 * 1024 * 1024], rom);
} | rust_cleaned_test_functions.jsonl/99946 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81383,
80772,
45233,
3575,
368,
341,
286,
1077,
5206,
9882,
284,
7486,
20703,
15,
26,
220,
16,
17,
353,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
4821,
286,
11016,
81383,
2099,
6984,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_comprread() {
let vec = vec![0x23, 0x47, 0xFA, 0x7D, 0x59, 0xFF, 0xA1, 0x84];
let read1 = CompressedRead::from_compressed_reads(&vec[..], 0, 32).sub_slice(1..32);
let read12 = CompressedRead::from_compressed_reads(&vec[..], 1, 31).sub_slice(0..31);
println!("{}", read1.to_string());
println!("{}", read12.to_string());
} | rust_cleaned_test_functions.jsonl/17107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
649,
878,
368,
341,
286,
1077,
7486,
284,
7486,
20703,
15,
87,
17,
18,
11,
220,
15,
87,
19,
22,
11,
220,
15,
72068,
11,
220,
15,
87,
22,
35,
11,
220,
15,
87,
20,
24,
11,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gt_positive_and_negative() {
assert!(decimal("1.0") > decimal("-1.0"));
assert!(decimal("1.1") > decimal("-1.1"));
assert!(decimal("0.1") > decimal("-0.1"));
} | rust_cleaned_test_functions.jsonl/58121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37479,
54160,
8378,
53865,
368,
341,
262,
2060,
10297,
23289,
445,
16,
13,
15,
899,
861,
12122,
13645,
16,
13,
15,
4010,
262,
2060,
10297,
23289,
445,
16,
13,
16,
899,
861,
12122,
13645,
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 |
#[test]
fn test_upload_compressed() {
let s3client = crate::get_s3client();
let filename = "27-185232-msg.csv";
let filepath = format!("tests/data/{}", filename);
let s3_key = format!("test_upload/{}.gz", filename);
let res =
blocking::upload_compressed(s3client.as_ref(), crate::TEST_BUCKET, &s3_key, &filepath);
assert!(res.is_ok());
let res = blocking::head_object(s3client.as_ref(), crate::TEST_BUCKET, &s3_key);
let obj_info: Option<ObjectInfo> = res.unwrap();
assert!(obj_info.is_some());
let obj_info: ObjectInfo = obj_info.unwrap();
assert_eq!(obj_info.size, 3344161);
assert_eq!(obj_info.e_tag, "\"4a57bdf6ed65bc7e9ed34a4796561f06\"");
assert_eq!(
obj_info.metadata.get("esthri_compress_version").unwrap(),
env!("CARGO_PKG_VERSION")
);
} | rust_cleaned_test_functions.jsonl/84175 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21691,
2965,
14318,
368,
341,
262,
1077,
274,
18,
2972,
284,
17717,
486,
455,
643,
18,
2972,
543,
262,
1077,
3899,
284,
330,
17,
22,
12,
16,
23,
20,
17,
18,
17,
57462,
11219,
876,
262,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_shares_reshare() {
let n = 5;
let thr = default_threshold(n);
println!(" -------- FIRST SCENARIO ---------- ");
// scenario 1.
// just change two shares and give it invalid things
let (dkgs, public) = setup_reshare::<BCurve>(n, thr, 0, 0);
let reshared = invalid_shares(thr, dkgs, invalid2, id_resp, check2, id_out).unwrap();
// test that it gives the same public key
assert_eq!(public.public_key(), reshared.public_key());
println!(" -------- SECOND SCENARIO ---------- ");
// SCENARIO 2.
// change the public polynomial to NOT be the commitment of the previous
// share
let (dkgs, public) = setup_reshare::<BCurve>(n, thr, 0, 0);
let group = dkgs[0].info.prev_group.clone();
let target_idx: usize = 0;
let inv_public = |mut s: Vec<BundledShares<BCurve>>| {
let nsecret = Poly::<Scalar>::new_from(thr - 1, &mut thread_rng());
let npublic = nsecret.commit::<G1>();
s[target_idx] = create_share_bundle(
s[target_idx].dealer_idx,
&nsecret,
&npublic,
&group,
&mut thread_rng(),
)
.unwrap();
s
};
let reshared = invalid_shares(
thr,
dkgs,
inv_public,
id_resp,
|j| {
assert_eq!(j.len(), 1);
assert_eq!(j[0].dealer_idx, target_idx as u32);
j
},
|outs| outs.into_iter().filter(|o| o.share.index != 0).collect(),
)
.unwrap();
// test that it gives the same public key
assert_eq!(public.public_key(), reshared.public_key());
// SCENARIO 3
// less than a threshold of old nodes is giving good shares
let (dkgs, _) = setup_reshare::<BCurve>(n, thr, 0, 0);
let group = dkgs[0].info.prev_group.clone();
invalid_shares(
thr,
dkgs,
|bundles| {
bundles
.into_iter()
.map(|mut b| {
if b.dealer_idx < (n - thr) as u32 {
return b;
}
let msg = vec![1, 9, 6, 9];
b.shares[((b.dealer_idx + 1) as usize % group.len()) as usize].secret =
ecies::encrypt::<BCurve, _>(
&G1::rand(&mut thread_rng()),
&msg,
&mut thread_rng(),
);
b
})
.collect()
},
id_resp,
// we skip too many justifications such that the protocol should
// fail
|bundles| bundles.into_iter().skip(thr - 1).collect(),
|outs| outs.into_iter().filter(|o| o.share.index != 0).collect(),
)
.unwrap_err();
} | rust_cleaned_test_functions.jsonl/75097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1786
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
3712,
5403,
62,
2488,
546,
368,
341,
286,
1077,
308,
284,
220,
20,
280,
286,
1077,
8807,
284,
1638,
21858,
1445,
317,
286,
13751,
17223,
56136,
34813,
7531,
94274,
43789,
7318,
286,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add_millis_0() {
test_add(
TimeGranularity::Millis,
0,
"2000-01-01T00:00:00.0",
"2000-01-01T00:00:00.0",
);
} | rust_cleaned_test_functions.jsonl/134039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
717,
56212,
62,
15,
368,
341,
286,
1273,
2891,
1006,
310,
4120,
90723,
28979,
486,
17897,
345,
310,
220,
15,
345,
310,
330,
17,
15,
15,
15,
12,
15,
16,
12,
15,
16,
51,
15,
15,
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_candidacy() {
let bss_candidacy = fake_bss!(Wpa2, rssi_dbm: -10).candidacy();
assert_eq!(
bss_candidacy,
BssCandidacy { protection: Protection::Wpa2Personal, rssi_dbm: -10 }
);
let bss_candidacy = fake_bss!(Open, rssi_dbm: -10).candidacy();
assert_eq!(bss_candidacy, BssCandidacy { protection: Protection::Open, rssi_dbm: -10 });
let bss_candidacy = fake_bss!(Wpa2, rssi_dbm: -20).candidacy();
assert_eq!(
bss_candidacy,
BssCandidacy { protection: Protection::Wpa2Personal, rssi_dbm: -20 }
);
let bss_candidacy = fake_bss!(Wpa2, rssi_dbm: 0).candidacy();
assert_eq!(
bss_candidacy,
BssCandidacy { protection: Protection::Wpa2Personal, rssi_dbm: i8::MIN }
);
} | rust_cleaned_test_functions.jsonl/60271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
4551,
2757,
368,
341,
286,
1077,
293,
778,
666,
4551,
2757,
284,
12418,
880,
778,
10297,
54,
6595,
17,
11,
435,
45656,
8685,
76,
25,
481,
16,
15,
568,
66,
4551,
2757,
543,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_partitions_for_path_windows() {
assert_eq!(
Some(vec!["v1"]),
parse_partitions_for_path(
"bucket\\mytable",
"bucket\\mytable\\mypartition=v1\\file.csv",
&[String::from("mypartition")]
)
);
assert_eq!(
Some(vec!["v1", "v2"]),
parse_partitions_for_path(
"bucket\\mytable",
"bucket\\mytable\\mypartition=v1\\otherpartition=v2\\file.csv",
&[String::from("mypartition"), String::from("otherpartition")]
)
);
} | rust_cleaned_test_functions.jsonl/45585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
99097,
5478,
2638,
58220,
368,
341,
286,
2060,
10714,
33673,
310,
4329,
25592,
0,
1183,
85,
16,
46442,
310,
4715,
99097,
5478,
2638,
1006,
394,
330,
30410,
3422,
2408,
2005,
756,
394,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_ies() {
let bytes = [
48, 6, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 4, 0, 1, 2, 0x55, 0xaa,
];
let ies = InformationElements::parse(&bytes);
assert_eq!(ies.elements.len(), 3);
} | rust_cleaned_test_functions.jsonl/37530 | {
"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,
21039,
62,
550,
368,
341,
286,
1077,
5820,
284,
2278,
310,
220,
19,
23,
11,
220,
21,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_virtual_ignore_private() {
let output = cargo_hack()
.args(&["hack", "check", "--ignore-private"])
.current_dir(test_dir("tests/fixtures/virtual"))
.output()
.unwrap();
output
.assert_success()
.assert_stderr_contains("running `cargo check` on member1")
.assert_stderr_not_contains("running `cargo check` on member2")
.assert_stderr_not_contains("skipped running on member1")
.assert_stderr_contains("skipped running on member2");
let output = cargo_hack()
.args(&["hack", "check", "--all", "--ignore-private"])
.current_dir(test_dir("tests/fixtures/virtual"))
.output()
.unwrap();
output
.assert_success()
.assert_stderr_contains("running `cargo check` on member1")
.assert_stderr_not_contains("running `cargo check` on member2")
.assert_stderr_not_contains("skipped running on member1")
.assert_stderr_contains("skipped running on member2");
} | rust_cleaned_test_functions.jsonl/25296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58730,
58493,
26249,
368,
341,
262,
1077,
2550,
284,
25652,
1523,
473,
741,
286,
659,
2116,
2099,
1183,
65972,
497,
330,
2028,
497,
14482,
13130,
65277,
14108,
286,
659,
3231,
4334,
8623,
4334,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_old() {
let mut crds = Crds::default();
let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default()));
assert_eq!(crds.insert(val.clone(), 0), Ok(()));
assert_eq!(crds.insert(val.clone(), 1), Err(CrdsError::InsertFailed));
assert!(crds.purged.is_empty());
assert_eq!(crds.table[&val.label()].local_timestamp, 0);
} | rust_cleaned_test_functions.jsonl/10448 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
21108,
368,
341,
286,
1077,
5206,
1560,
5356,
284,
4553,
5356,
486,
2258,
543,
286,
1077,
1044,
284,
4553,
5356,
1130,
486,
931,
67830,
3025,
81,
5356,
1043,
486,
8732,
1731,
99102,
1731,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dense_activate() {
let l = Dense::<f64> {
input_shape: Shape::new([2, 3]),
output_shape: Shape::new([3, 4]),
weight: vec![0.; 12_usize],
bias: vec![0.; 12_usize],
activation: Activation::<f64>::Sigmoid,
};
let output = Tensor::<f64>::new(&Shape::new([3, 4]), vec![
-3., -2., -1., 0.,
1., 2., 3., 4.,
5., 6., 7., 8.,
]);
let mut ans_vec = vec![0.; 12];
for (y, x) in ans_vec.iter_mut().zip(output.flattened.iter()) {
*y = Activation::<f64>::Sigmoid.call(*x);
}
let answer = Tensor::<f64>::new(&Shape::new([3, 4]), ans_vec);
assert_eq!(l.activate(&output).unwrap(), answer);
} | rust_cleaned_test_functions.jsonl/39097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72619,
67894,
368,
341,
262,
1077,
326,
284,
42522,
27638,
69,
21,
19,
29,
341,
286,
1946,
13597,
25,
22526,
486,
931,
2561,
17,
11,
220,
18,
17036,
286,
2550,
13597,
25,
22526,
486,
931,
2561... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.