> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# البدء السريع

> تعرّف على كيفية اختبار برنامج سولانا الخاص بك باستخدام LiteSVM

## الإعداد

قبل اختبار برنامجك، تأكد من أنك:

1. قمت ببناء برنامجك لإنشاء ملف `.so`
2. أضفت `litesvm` كاعتمادية تطوير (dev dependency) إلى ملف `Cargo.toml`
3. أضفت أي اعتماديات تطوير إضافية قد تحتاج إليها، مثل `solana-sdk@4` و
   `litesvm-token`
4. أنشأت ملف اختبار في مجلد `tests` الخاص بك

## التخطيط الأساسي لاختبار البرنامج

فيما يلي جميع الخطوات الأساسية اللازمة لاستدعاء تعليمة وتنفيذها في برنامج
على سولانا.

```rust tests/program_test.rs
use litesvm::LiteSVM;
use solana_sdk::{
    instruction::{AccountMeta, Instruction},
    pubkey::Pubkey,
    signature::{Keypair, Signer},
    transaction::Transaction,
};

use my_program;

#[test]
fn test_my_program() {
    // Initialize the test environment
    let mut svm = LiteSVM::new();

    // Deploy your program to the test environment. If your program uses an
    // older solana-program (such as 2.2), its ID is a different Pubkey type,
    // so convert it through its bytes.
    let program_id = Pubkey::new_from_array(my_program::ID.to_bytes());
    let program_bytes = include_bytes!("../../../target/deploy/my_program.so");
    svm.add_program(program_id, program_bytes).unwrap();

    // Create and fund test accounts
    let payer = Keypair::new();
    svm.airdrop(&payer.pubkey(), 10_000_000_000).unwrap();

    // Create your instruction
    let instruction = Instruction {
        program_id,
        accounts: vec![
            AccountMeta::new(payer.pubkey(), true),
        ],
        data: vec![],
    };

    // Build transaction
    let tx = Transaction::new_signed_with_payer(
        &[instruction],
        Some(&payer.pubkey()),
        &[&payer],
        svm.latest_blockhash(),
    );

    // Send transaction
    let result = svm.send_transaction(tx).unwrap();

    // Check transaction succeeded
    println!("Transaction logs: {:?}", result.logs);

    println!("Program executed successfully!");
}
```

تُفعّل بيئة الاختبار الافتراضية التي يتم إنشاؤها باستخدام `LiteSVM::new()`
ميزات وقت التشغيل المفعّلة حاليًا على mainnet-beta، وsysvars الافتراضية، وبرامج spl،
وsigverify، وجميع البرامج المدمجة، مثل System Program.
يتم تضمين البرامج المُجمّعة مسبقًا (ed25519 وsecp256k1 وsecp256r1) عند تفعيل الميزة `precompiles`
في `litesvm`.

لبناء البيئة بالكامل من مجموعة ميزات أخرى، مثل
`FeatureSet::all_enabled()` من الحزمة `agave-feature-set`، ابدأ من
`LiteSVM::default()` لكي تتطابق sysvars وحسابات الميزات معها:

```rust
use agave_feature_set::FeatureSet;
use litesvm::LiteSVM;
use solana_sdk::native_token::LAMPORTS_PER_SOL;

let mut svm = LiteSVM::default()
    .with_feature_set(FeatureSet::all_enabled())
    .with_builtins()
    .with_lamports(1_000_000 * LAMPORTS_PER_SOL)
    .with_sysvars()
    .with_feature_accounts()
    .with_default_programs()
    .with_sigverify(true)
    .with_blockhash_check(true);
```

إن ربط `with_feature_set` بعد `LiteSVM::new()` يستبدل مجموعة الميزات فقط:
يبقى sysvar الخاص بـ Rent وحسابات الميزات كما أعدّها `new()`
لميزات mainnet.

<Info>
  إذا أردت التفاعل مع أي برنامج غير مضمَّن في بيئة الاختبار الافتراضية،
  فيجب نشر هذا البرنامج في بيئة الاختبار.
</Info>

## الخطوات التالية

في القسم التالي، سنتعرف على كل ما يخص نشر البرامج في بيئة اختبار
litesvm.
