# FBE Rust Tests
Organized test suite for FBE Rust implementation.
## Test Organization
### 01_basic/ - Basic Types (4 tests)
- `01_basic_enum.rs` - Enum parsing and generation
- `01_basic_flags.rs` - Flag bitwise operations
- `01_basic_types.rs` - Primitive type coverage
- `01_basic_field_model.rs` - FieldModel trait basics
**Coverage**: Enums, flags, all 14 primitive types
---
### 02_collection/ - Collections (6 tests)
- `02_collection_array.rs` - Fixed arrays Type[N]
- `02_collection_vector.rs` - Vectors Type[]
- `02_collection_map.rs` - Maps K<V>
- `02_collection_field_models.rs` - FieldModel for collections
- `02_collection_string.rs` - String collections
- `02_collection_float.rs` - Float/double collections
**Coverage**: All 5 FBE collection types
---
### 03_optional/ - Optional Types (1 test)
- `03_optional_all_types.rs` - All 18 optional type combinations
**Coverage**: bool?, int*?, string?, bytes?, collections?, custom structs?
---
### 04_inheritance/ - Inheritance (1 test)
- `04_inheritance_verification.rs` - Multi-level inheritance (up to 6 levels)
**Coverage**: Parent-child relationships, recursive field collection
---
### 05_compliance/ - FBE Spec Compliance (6 tests)
- `05_compliance_fbe_spec.rs` - FBE Specification compliance
- `05_compliance_cpp_reference.rs` - C++ reference comparison
- `05_compliance_cpp_100.rs` - 100% C++ parity test
- `05_compliance_ultimate.rs` - Ultimate comprehensive test
- `05_compliance_100_percent.rs` - 100% feature test
- `05_compliance_final.rs` - Final compliance calculation
**Coverage**: Full FBE Spec, C++ parity, all features
---
### 06_integration/ - Integration Tests (5 tests)
- `06_integration_agent_protocol.rs` - Panilux agent protocol
- `06_integration_comprehensive.rs` - Comprehensive FBE test
- `06_integration_complicated.rs` - Complex scenarios
- `06_integration_order_spec.rs` - Order struct spec
- `06_integration_binary_compat.rs` - Binary compatibility
**Coverage**: Real-world usage, protocol testing
---
### 07_runtime/ - Runtime Verification (2 tests)
- `07_runtime_functionality.rs` - Runtime method testing (List, Map, Set, etc.)
- `07_runtime_gap_analysis.rs` - Gap analysis (what's missing)
**Coverage**: Runtime library functionality, buffer methods
---
## Running Tests
### Run All Tests
```bash
cargo test
```
### Run By Category
```bash
cargo test --test 01_basic_enum # Basic types
cargo test --test 02_collection_array # Collections
cargo test --test 03_optional_all_types # Optionals
cargo test --test 04_inheritance # Inheritance
cargo test --test 05_compliance_ultimate # Ultimate compliance
cargo test --test 06_integration_agent # Integration
cargo test --test 07_runtime_functionality # Runtime
```
### Run Compliance Suite
```bash
cargo test --test 05_compliance_cpp_100 -- --nocapture
```
### Run Quick Smoke Test
```bash
cargo test --test 01_basic_enum --test 02_collection_array
```
---
## Test Output
Generated code: `../test_gen/`
Structure:
```
test_gen/
├── 01_basic/ # From 01_basic_agent.fbe
├── 02_intermediate/ # From 02_intermediate_complicated.fbe
├── 03_stress/ # From 03_stress_mega.fbe
├── 04_optional/ # From 04_optional_all_types.fbe
├── 05_spec/ # From 05_spec_compliance.fbe
├── 06_ultimate/ # From 06_ultimate_all_features.fbe
└── 07_cpp_ref/ # From 07_cpp_reference_proto.fbe
```
**Note**: `test_gen/` is in .gitignore (generated code not committed)
---
## Test Statistics
- **Total Tests**: 25
- **Schemas**: 7
- **Generated Structs**: 100+
- **Coverage**: ~98% FBE Spec
- **C++ Parity**: 100%
---
## Test Results Summary
All tests should pass:
```
running 25 tests
test 01_basic_enum ... ok
test 02_collection_array ... ok
...
test 07_runtime_functionality ... ok
test result: ok. 25 passed; 0 failed
```
---
## Maintenance
### Adding New Tests
1. Create test in appropriate category (01-07)
2. Name with category prefix: `0X_category_feature.rs`
3. Use `test_gen/0X_category/` for output
4. Update this README
### Removing Tests
1. Delete test file
2. Clean test_gen output if needed
3. Update this README
---
Last Updated: 2025-10-25