-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[prakriya] Add around 250 taddhita tests
This commit massively expands and streamlines the taddhita section. Although more cleanup work can be done here, there's enough of a framework that the rest of the rules are easier to fill in.
- Loading branch information
Showing
57 changed files
with
5,337 additions
and
975 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
www/static/data/ | ||
www/static/wasm/ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env python3 | ||
from pathlib import Path | ||
import re | ||
import glob | ||
|
||
RULE_OK = "✅" | ||
RULE_UNTESTED = "⚠️ " | ||
RULE_MISSING = "❌" | ||
|
||
def print_legend(): | ||
print("===== Legend ======") | ||
print(f"{RULE_OK}\t\tSutra is tested.") | ||
print(f"{RULE_UNTESTED}\t\tSutra is implemented but untested.") | ||
print(f"{RULE_MISSING}\t\tSutra is missing.") | ||
print() | ||
print("These statuses are heuristics. Verify them by checking the underlying code.") | ||
print("===================") | ||
|
||
base = Path(__file__).parent.parent | ||
src = base / "src" | ||
tests = base / "tests" | ||
|
||
all_rules = [] | ||
with open(base / "data/sutrapatha.tsv") as f: | ||
for line in f: | ||
code, text = line.split('\t') | ||
all_rules.append(code) | ||
|
||
|
||
implemented_rules = set() | ||
for path in glob.glob("**/*.rs", root_dir=src, recursive=True): | ||
with open(src / path) as f: | ||
for line in f: | ||
if m := re.search(r'"(\d+\.\d+\.\d+)', line): | ||
implemented_rules.add(m.group(1)) | ||
|
||
tested_rules = set() | ||
for path in glob.glob("**/*.rs", root_dir=tests, recursive=True): | ||
with open(tests / path) as f: | ||
for line in f: | ||
if m := re.search(r"(\d+_\d+_\d+)", line): | ||
tested_rules.add(m.group(1).replace('_', '.')) | ||
|
||
print_legend() | ||
for rule in all_rules: | ||
status = None | ||
if rule in tested_rules: | ||
status = RULE_OK | ||
elif rule in implemented_rules: | ||
status = RULE_UNTESTED | ||
else: | ||
status = RULE_MISSING | ||
print(f"{status}\t\t{rule}") | ||
print_legend() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.