Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unordered compare diamond nodes #81

Merged
merged 2 commits into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tests/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ class Result:
expected: str
command: list[str]

def unordered_compare(out, expected):
if out == expected:
return True

out_parts = out.split()
expected_parts = expected.split()
return sorted(out_parts) == sorted(expected_parts)

async def test(runner: str, case_: TestCase) -> Result:
cmd = [runner, case_['cps']] + case_['args']
Expand All @@ -77,7 +84,7 @@ async def test(runner: str, case_: TestCase) -> Result:
out = bout.decode().strip()
err = berr.decode().strip()

success = proc.returncode == case_.get('returncode', 0) and out == expected
success = proc.returncode == case_.get('returncode', 0) and unordered_compare(out, expected)
result = Status.PASS if success else Status.FAIL
returncode = proc.returncode
except asyncio.TimeoutError:
Expand Down
Loading