File tree Expand file tree Collapse file tree 2 files changed +16
-15
lines changed
Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22
3+ import asn1tools
4+ import glob
35import os
46import 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" )
You can’t perform that action at this time.
0 commit comments