Use commands instead of name conventions
So this is an idea that came to me yesterday after our talk. There are lots of points in the system testing workflow, where we have to have some contract with the user on where specific information is. We have the following possibilities:
- Assume special key names (might come as a surprise)
- Assume special key names marked with underscores (looks complicated for some reason)
- Introducing special section (might also look complicated)
- Use special commands
I came to think that it might be nice to have more commands. You do not even need a command for each key, you can use arguments to commands.
So, I would to see the convergence test controlled by this snippet:
output = out | unique
Grid.Level = 1, 2, 3 | convergence_test
ExpectedRate = 1 | convergence_test rate
AbsoluteDiff = 0.1 | convergence_test tolerance
NormType = l2norm | convergence_test normtype
QuantityName = hmax | convergence_test quantity
I can see the disadvantage of the actual key name being rather irrelevant. But I think you can document such behaviour quite good.
I am not only thinking about testtools here. One thing that is usually biting me, when looking at meta ini files, is that the static section usually looks complicated. I would like to have a command "static" that marks something a compile definition (Lets be honest, there is no good other section than compile definitions). Example:
GRIDTYPE = Dune::YaspGrid<2>, Dune::UGGrid<2> | static | expand
Technically this is not complicated I think. The only real difference is: You need a filtering algorithm which filters keys that have a specific command applied. Easy.
EDIT
-
Apply the concept of commands in connection with nkv throughout dune-testtools