X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=tests%2Futils%2Fpython%2Fsplit_sort_compare.py;fp=tests%2Futils%2Fpython%2Fsplit_sort_compare.py;h=3b4f83d58d5246070f33cc0820c5430dad158126;hp=0000000000000000000000000000000000000000;hb=ed30eb8d59e3bc1d26808d3414a1fbc5f8bb23d8;hpb=101fde11a54b96fcc2e2bb63e55a0d44162642e4 diff --git a/tests/utils/python/split_sort_compare.py b/tests/utils/python/split_sort_compare.py new file mode 100644 index 00000000..3b4f83d5 --- /dev/null +++ b/tests/utils/python/split_sort_compare.py @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2020 Francis Deslauriers + +import sys +import re + + +def main(): + expected = sys.argv[1] + actual = sys.argv[2] + sorted_expected = ''.join(sorted(re.findall(r'\w+|\W+', expected.strip()))) + sorted_actual = ''.join(sorted(re.findall(r'\w+|\W+', actual.strip()))) + + if sorted_expected == sorted_actual: + status = 0 + else: + status = 1 + + sys.exit(status) + + +if __name__ == '__main__': + main()