Skip to content

Commit 6d8fef6

Browse files
committed
Accumulate vectors
1 parent 346c8fd commit 6d8fef6

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ jobs:
2525
pip install git+https://github.com/davxy/asn1tools.git
2626
- name: Validate vectors
2727
run: |
28-
./codec/validate.py
28+
for v in codec accumulate; do
29+
./$v/validate.py
30+
done

accumulate/validate.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
#!/usr/bin/env python
22

3+
import asn1tools
4+
import glob
35
import os
46
import sys
5-
from pathlib import Path
67

7-
import asn1tools
8+
script_dir = os.path.dirname(os.path.abspath(__file__))
9+
sys.path.append(os.path.abspath(os.path.join(script_dir, '../jam-types-asn')))
810

9-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../jam-types-asn')))
10-
from utils import get_schema_files, validate
11+
from utils import get_schema_files, validate # noqa: E402
1112

13+
os.chdir(script_dir)
1214

13-
# Validate tiny
14-
schema = asn1tools.compile_files(get_schema_files(False) + ["accumulate.asn"], codec="jer")
15-
for path in Path("tiny").iterdir():
16-
if path.is_file() and path.suffix == ".json":
17-
validate(schema, path, "TestCase")
15+
def validate_spec(spec_name):
16+
print(f"[Validating '{spec_name}' spec]")
17+
schema = asn1tools.compile_files(get_schema_files(spec_name == "full") + ["accumulate.asn"], codec="jer")
18+
for json_file in glob.glob(f"{spec_name}/*.json"):
19+
validate(schema, json_file, "TestCase")
1820

19-
# Validate full
20-
schema = asn1tools.compile_files(get_schema_files(True) + ["accumulate.asn"], codec="jer")
21-
for path in Path("full").iterdir():
22-
if path.is_file() and path.suffix == ".json":
23-
validate(schema, path, "TestCase")
21+
validate_spec("tiny")
22+
validate_spec("full")

0 commit comments

Comments
 (0)