2021-08-11 12:07:15 -07:00
|
|
|
#![cfg(feature = "test-bpf")]
|
|
|
|
|
2022-02-21 19:59:06 -08:00
|
|
|
use {
|
|
|
|
solana_program_test::*,
|
2022-10-10 12:43:53 -07:00
|
|
|
solana_sbf_rust_sanity::process_instruction,
|
2022-02-21 19:59:06 -08:00
|
|
|
solana_sdk::{
|
|
|
|
instruction::{AccountMeta, Instruction},
|
|
|
|
pubkey::Pubkey,
|
|
|
|
signature::{Keypair, Signer},
|
|
|
|
transaction::Transaction,
|
|
|
|
},
|
2021-08-11 12:07:15 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#[tokio::test]
|
2023-03-12 22:28:34 -07:00
|
|
|
async fn test_sanity() {
|
2021-08-11 12:07:15 -07:00
|
|
|
let program_id = Pubkey::new_unique();
|
|
|
|
let program_test = ProgramTest::new(
|
2022-10-10 12:43:53 -07:00
|
|
|
"solana_sbf_rust_sanity",
|
2021-08-11 12:07:15 -07:00
|
|
|
program_id,
|
|
|
|
processor!(process_instruction),
|
|
|
|
);
|
|
|
|
let (mut banks_client, payer_keypair, recent_blockhash) = program_test.start().await;
|
|
|
|
|
|
|
|
let mut transaction = Transaction::new_with_payer(
|
|
|
|
&[Instruction::new_with_bincode(
|
|
|
|
program_id,
|
|
|
|
&(),
|
|
|
|
vec![
|
|
|
|
AccountMeta::new(payer_keypair.pubkey(), true),
|
|
|
|
AccountMeta::new(Keypair::new().pubkey(), false),
|
|
|
|
],
|
|
|
|
)],
|
|
|
|
Some(&payer_keypair.pubkey()),
|
|
|
|
);
|
|
|
|
transaction.sign(&[&payer_keypair], recent_blockhash);
|
|
|
|
banks_client.process_transaction(transaction).await.unwrap();
|
|
|
|
}
|