Local project checks and contribution templates: make check, dependency-free C/python tests, issue forms + blank issues, CONTRIBUTING (#20)

* Add lightweight project checks and templates

* Ignore generated test binaries

* Keep project checks local
This commit is contained in:
ZacharyZcR
2026-07-10 14:56:41 +08:00
committed by GitHub
parent 99111993a4
commit 8a2e4439ba
12 changed files with 276 additions and 6 deletions
+24
View File
@@ -0,0 +1,24 @@
import unittest
from benchmark_cuda_fixture import parse_output
SAMPLE = """
REPLAY decode: 4 tokens | 12.34 tok/s
PROFILO: expert-disk 1.25s | expert-matmul 2.50s | attention 0.75s | lm_head 0.10s | altro -0.05s
"""
class ParseOutputTest(unittest.TestCase):
def test_extracts_speed_and_profile(self):
speed, profile = parse_output(SAMPLE)
self.assertEqual(speed, 12.34)
self.assertEqual(profile, [1.25, 2.5, 0.75, 0.1, -0.05])
def test_rejects_incomplete_output(self):
with self.assertRaisesRegex(RuntimeError, "benchmark output missing"):
parse_output("REPLAY decode: 4 tokens | 12.34 tok/s", "engine failed")
if __name__ == "__main__":
unittest.main()