95 lines
2.5 KiB
Python
95 lines
2.5 KiB
Python
"""Tests to lock turboquant genome to current repo facts. Ref: #679, #827."""
|
|
from pathlib import Path
|
|
|
|
GENOME = Path("genomes/turboquant/GENOME.md")
|
|
|
|
|
|
def read_genome() -> str:
|
|
assert GENOME.exists(), "turboquant genome must exist at genomes/turboquant/GENOME.md"
|
|
return GENOME.read_text(encoding="utf-8")
|
|
|
|
|
|
def test_genome_exists():
|
|
assert GENOME.exists(), "turboquant genome must exist at genomes/turboquant/GENOME.md"
|
|
|
|
|
|
def test_genome_has_required_sections():
|
|
text = read_genome()
|
|
for heading in [
|
|
"# GENOME.md — TurboQuant",
|
|
"## Project Overview",
|
|
"## Architecture",
|
|
"## Entry Points",
|
|
"## Data Flow",
|
|
"## Key Abstractions",
|
|
"## API Surface",
|
|
"## File Index",
|
|
"## CI / Runtime Drift",
|
|
"## Test Coverage Gaps",
|
|
"## Security Considerations",
|
|
"## Dependencies",
|
|
"## Deployment",
|
|
"## Technical Debt",
|
|
]:
|
|
assert heading in text, f"Missing required section: {heading}"
|
|
|
|
|
|
def test_genome_contains_mermaid_diagram():
|
|
text = read_genome()
|
|
assert "```mermaid" in text
|
|
assert "graph TD" in text
|
|
|
|
|
|
def test_genome_captures_core_c_api():
|
|
text = read_genome()
|
|
for token in [
|
|
"polar_quant_encode_turbo4",
|
|
"polar_quant_decode_turbo4",
|
|
"llama-turbo.h",
|
|
"llama-turbo.cpp",
|
|
"ggml-metal-turbo.metal",
|
|
]:
|
|
assert token in text, f"Missing core C API token: {token}"
|
|
|
|
|
|
def test_genome_captures_cmake_ctest_path():
|
|
text = read_genome()
|
|
for token in [
|
|
"cmake -S . -B build",
|
|
"DTURBOQUANT_BUILD_TESTS=ON",
|
|
"ctest --test-dir build",
|
|
"turboquant_roundtrip_test",
|
|
]:
|
|
assert token in text, f"Missing CMake/CTest token: {token}"
|
|
|
|
|
|
def test_genome_captures_quant_selector_and_drift():
|
|
text = read_genome()
|
|
for token in [
|
|
"quant_selector.py",
|
|
"test_quant_selector.py",
|
|
"turboquant #139",
|
|
"CI / Runtime Drift",
|
|
"failing",
|
|
"non-blocking",
|
|
]:
|
|
assert token in text, f"Missing quant selector / drift token: {token}"
|
|
|
|
|
|
def test_genome_captures_metal_shader_limitations():
|
|
text = read_genome()
|
|
for token in [
|
|
"Metal",
|
|
"Apple Silicon",
|
|
"CI runners",
|
|
"turbo_dequantize_k",
|
|
"turbo_dequantize_v",
|
|
"turbo_fwht_128",
|
|
]:
|
|
assert token in text, f"Missing Metal shader token: {token}"
|
|
|
|
|
|
def test_genome_is_substantial():
|
|
text = read_genome()
|
|
assert len(text) >= 4000, "Genome should be at least 4000 chars"
|