From 074bc71b3b18cdeff8e65cbb2e8b35988e77dde7 Mon Sep 17 00:00:00 2001 From: Ragnar Groot Koerkamp Date: Fri, 8 Mar 2024 17:24:51 +0100 Subject: [PATCH] Process top level directories in order sample/secret/invalid_{output/answer/input} --- bin/generate.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/bin/generate.py b/bin/generate.py index 56db11f7e..d865ba595 100644 --- a/bin/generate.py +++ b/bin/generate.py @@ -1360,7 +1360,26 @@ def parse(key, name, yaml, parent): for key in dictionary: check_type('Testcase/directory name', key, [type(None), str], d.path) - for child_key, child_yaml in sorted(dictionary.items()): + # Process named children alphabetically, but not in the root directory. + # There, process in the 'natural order'. + order = [ + 'sample', + 'secret', + 'invalid_outputs', + 'invalid_answers', + 'invalid_inputs', + ] + keys = dictionary.keys() + if isinstance(parent, RootDirectory): + keys = sorted( + keys, + key=lambda k: (order.index(k), k) if k in order else (999, k), + ) + else: + keys = sorted(keys) + + for child_key in keys: + child_yaml = dictionary[child_key] if d.numbered: if is_directory(child_yaml): testgroup_id += 1