More consistent default handling for StringOption
authorTeemu Murtola <teemu.murtola@gmail.com>
Tue, 26 Aug 2014 16:28:43 +0000 (19:28 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sun, 7 Sep 2014 20:23:08 +0000 (22:23 +0200)
commit236deaf1539a55c3f03ff40e16175ffcb65a6cfe
treecdea192e5f3e46da584ed5593e68de6fb7b17052
parent61e3221db79c7f1a37a4cbd6c37c762f3277048a
More consistent default handling for StringOption

For enumerated StringOptions, the enum indexes were not always
consistently handled.  Added a few tests for the behavior, and fixed it.
Now the storeEnumIndex() option works consistently in that if the caller
specifies an initial value for the variable, and there is no other
default, the caller-provided value is preserved.  Also, the stored enum
index is properly updated if a default value is provided through a value
in the output variable.

Fixes #1586

Change-Id: Ib9d24e977dbfde6b23ba90271574cdd43c70c1bd
src/gromacs/options/basicoptions.cpp
src/gromacs/options/basicoptions.h
src/gromacs/options/basicoptionstorage.h
src/gromacs/options/tests/optionsassigner.cpp