32 lines
1.2 KiB
Rust
32 lines
1.2 KiB
Rust
// file: crates/ksp-interface-lib/unit_tests/program_account_meta.rs
|
|
// version: 1
|
|
|
|
#[test]
|
|
fn readonly_and_writable_constructors_preserve_identity_signer_and_writable_flags() {
|
|
let readonly_pubkey = crate::Pubkey::new_from_array([7_u8; 32]);
|
|
let writable_pubkey = crate::Pubkey::new_from_array([9_u8; 32]);
|
|
let readonly = crate::ProgramAccountMeta::readonly(readonly_pubkey, true);
|
|
assert_eq!(readonly.pubkey(), &readonly_pubkey);
|
|
assert!(readonly.is_signer());
|
|
assert!(!readonly.is_writable());
|
|
let writable = crate::ProgramAccountMeta::writable(writable_pubkey, false);
|
|
assert_eq!(writable.pubkey(), &writable_pubkey);
|
|
assert!(!writable.is_signer());
|
|
assert!(writable.is_writable());
|
|
return;
|
|
}
|
|
|
|
#[test]
|
|
fn account_meta_accepts_opaque_pubkeys_without_program_registry_validation() {
|
|
let opaque_pubkey = crate::Pubkey::new_from_array([0xA5_u8; 32]);
|
|
let meta = crate::ProgramAccountMeta::readonly(opaque_pubkey, false);
|
|
assert_eq!(meta.pubkey(), &opaque_pubkey);
|
|
return;
|
|
}
|
|
|
|
#[test]
|
|
fn account_limit_constant_matches_the_interface_admission_contract() {
|
|
assert_eq!(crate::MAX_PROGRAM_INSTRUCTION_ACCOUNTS, 255);
|
|
return;
|
|
}
|