| 591 | // ═══════════════════════════════════════════════════════════════════════════════ |
| 592 | |
| 593 | int main(int argc, char ** argv) { |
| 594 | if (argc < 2) { |
| 595 | fprintf(stderr, "Usage: %s <ref_dir> [model.ggml] [image.jpg]\n", argv[0]); |
| 596 | fprintf(stderr, "\nGenerate reference data first:\n"); |
| 597 | fprintf(stderr, " uv run python tests/dump_phase3_reference.py \\\n"); |
| 598 | fprintf(stderr, " --checkpoint raw_weights/sam3.pt --image data/test_image.jpg\n"); |
| 599 | return 1; |
| 600 | } |
| 601 | |
| 602 | std::string ref_dir = argv[1]; |
| 603 | std::string model_path = (argc > 2) ? argv[2] : ""; |
| 604 | std::string image_path = (argc > 3) ? argv[3] : ""; |
| 605 | |
| 606 | int n_pass = 0, n_fail = 0; |
| 607 | |
| 608 | // Test 1: RoPE (no model needed) |
| 609 | test_rope(ref_dir, n_pass, n_fail); |
| 610 | |
| 611 | // Test 2: Sinusoidal PE (no model needed) |
| 612 | test_sinusoidal_pe(ref_dir, n_pass, n_fail); |
| 613 | |
| 614 | // Test 3: Full encoding (needs model + image) |
| 615 | if (!model_path.empty() && !image_path.empty()) { |
| 616 | test_encode_image(model_path, image_path, ref_dir, n_pass, n_fail); |
| 617 | } else { |
| 618 | fprintf(stderr, "\n[SKIP] Full encoding test — no model/image provided\n"); |
| 619 | } |
| 620 | |
| 621 | // Test 4: Isolated ViT numerics from Python-preprocessed input (needs model) |
| 622 | if (!model_path.empty()) { |
| 623 | test_encode_from_preprocessed(model_path, ref_dir, n_pass, n_fail); |
| 624 | } else { |
| 625 | fprintf(stderr, "\n[SKIP] Isolated ViT test — no model provided\n"); |
| 626 | } |
| 627 | |
| 628 | fprintf(stderr, "\n═══════════════════════════════════════════\n"); |
| 629 | fprintf(stderr, "Phase 3 Audit Results: %d passed, %d failed\n", n_pass, n_fail); |
| 630 | fprintf(stderr, "═══════════════════════════════════════════\n"); |
| 631 | return n_fail > 0 ? 1 : 0; |
| 632 | } |
nothing calls this directly
no test coverage detected