2020-01-28 17:03:20 -08:00
|
|
|
use solana_runtime::{
|
|
|
|
bank::Bank, bank_client::BankClient, loader_utils::create_invoke_instruction,
|
|
|
|
};
|
2020-10-19 12:23:14 -07:00
|
|
|
use solana_sdk::{client::SyncClient, genesis_config::create_genesis_config, signature::Signer};
|
2019-03-02 19:56:49 -08:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_program_native_noop() {
|
|
|
|
solana_logger::setup();
|
|
|
|
|
2019-11-08 20:56:57 -08:00
|
|
|
let (genesis_config, alice_keypair) = create_genesis_config(50);
|
2020-10-19 12:12:08 -07:00
|
|
|
let program_id = solana_sdk::pubkey::new_rand();
|
2019-11-08 20:56:57 -08:00
|
|
|
let bank = Bank::new(&genesis_config);
|
2020-11-05 07:37:07 -08:00
|
|
|
bank.add_native_program("solana_noop_program", &program_id, false);
|
2019-03-02 19:56:49 -08:00
|
|
|
|
|
|
|
// Call user program
|
2019-10-25 16:22:41 -07:00
|
|
|
let instruction = create_invoke_instruction(alice_keypair.pubkey(), program_id, &1u8);
|
|
|
|
let bank_client = BankClient::new(bank);
|
|
|
|
bank_client
|
2020-06-24 20:35:38 -07:00
|
|
|
.send_and_confirm_instruction(&alice_keypair, instruction)
|
2019-10-25 16:22:41 -07:00
|
|
|
.unwrap();
|
2019-03-02 19:56:49 -08:00
|
|
|
}
|