31 lines
681 B
Python
Executable File
31 lines
681 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
from glob import glob
|
|
from subprocess import call
|
|
from os.path import basename
|
|
|
|
tool="@CMAKE_CURRENT_BINARY_DIR@/json-compare"
|
|
src="@CMAKE_CURRENT_SOURCE_DIR@/test/json/compare"
|
|
suffix=".a.json"
|
|
|
|
failures = 0
|
|
|
|
for expected in [ "good", "bad" ]:
|
|
for path in glob(f"{src}/{expected}/*{suffix}"):
|
|
base = path[:-len(suffix)]
|
|
|
|
inputs = glob(f"{base}*.json")
|
|
code = call([tool, *inputs])
|
|
|
|
success = (expected == "good") == (code == 0)
|
|
|
|
prefix = ""
|
|
|
|
if not success:
|
|
prefix = "not "
|
|
failures += 1
|
|
|
|
print(prefix, "ok - ", expected, basename(base), code)
|
|
|
|
exit(1 if failures else 0)
|