
\begin{DoxyItemize}
\item infos = Information about the mathcheck plugin is in keys below
\item infos/author = Thomas Waser \href{mailto:thomas.waser@libelektra.org}{\tt thomas.\+waser@libelektra.\+org}
\item infos/licence = B\+S\+D
\item infos/provides = check
\item infos/needs =
\item infos/placements = presetstorage
\item infos/status = maintained unittest nodep discouraged
\item infos/metadata = check/math
\item infos/description = validates a set of keys through a mathematical expression
\end{DoxyItemize}

Compares a key value to a mathematical expression using polish prefix notation defined in the {\ttfamily check/math} metakey. Operations are {\ttfamily + -\/ / $\ast$} . Operants are keys with names relative to the parent key. How the values are compared is specified at the beginning of the metakey using the conditions {\ttfamily $<$, $<$=, ==, !=, =$>$, $>$, \+:=} {\ttfamily \+:=} is used to set key values. All values are interpreted as {\ttfamily double} floating point values.

\subsubsection*{Keynames}

Keynames are all either relative to to-\/be-\/tested key (starting with {\ttfamily ./} or {\ttfamily ../}), relative to the parentkey (starting with {\ttfamily @/}) or absolute (e.\+g. {\ttfamily system/key}).

\subsection*{Examples}

{\ttfamily check/math = \char`\"{}== + ../testval1 + ../testval2 ../testval3\char`\"{}} compares the keyvalue to the sum of testval1-\/3 and yields an error if the values are not equal. {\ttfamily check/math = \char`\"{}\textbackslash{}$<$= -\/ \textbackslash{}@/testval1 $\ast$ \textbackslash{}@/testval2 \textbackslash{}@/testval3\char`\"{}} tests if the keyvalue is less than or equal to testval1 -\/ (testval2 $\ast$ testval3) and yields an error if not.

Full example\+: ``` \section*{Backup-\/and-\/\+Restore\+:/examples/mathcheck}

kdb mount mathcheck.\+dump /examples/mathcheck dump mathcheck kdb set /examples/mathcheck/a 3.\+1 kdb set /examples/mathcheck/b 4.\+5 kdb set /examples/mathcheck/k 7.\+6 kdb setmeta user/examples/mathcheck/k check/math \char`\"{}== + ../a ../b\char`\"{} \section*{should fail}

kdb set /examples/mathcheck/k 7.\+7 \section*{R\+E\+T\+:5}

\section*{E\+R\+R\+O\+R\+S\+:123}

\section*{Set string to 7.\+7}

\section*{The command set failed while accessing the key database with the info\+:}

\section*{Error (\#123) occurred!}

\section*{Description\+: invalid value}

\section*{Ingroup\+: plugin}

\section*{Module\+: mathcheck}

\section*{At\+: /home/thomas/\+Dev/\+Elektra/libelektra/src/plugins/mathcheck/mathcheck.c\+:399}

\section*{Reason\+: 7.\+7 != 7.\+6}

\section*{Mountpoint\+: /examples/mathcheck}

\section*{Configfile\+: /home/thomas/.config/mathcheck.\+dump.\+25680\+:1478749409.\+938013.\+tmp}

kdb rm -\/r /examples/mathcheck kdb umount /examples/mathcheck ``` To calculate values on-\/demand you can use\+: ``` \section*{Backup-\/and-\/\+Restore\+:/examples/mathcheck}

kdb mount mathcheck.\+dump /examples/mathcheck dump mathcheck kdb setmeta user/examples/mathcheck/k check/math \char`\"{}\+:= + @/a @/b\char`\"{} kdb set /examples/mathcheck/a 8.\+0 kdb set /examples/mathcheck/b 4.\+5 kdb get /examples/mathcheck/k 12.\+5 kdb set /examples/mathcheck/a 5.\+5 kdb get /examples/mathcheck/k 10 kdb rm -\/r /examples/mathcheck kdb umount /examples/mathcheck ``` It also works with constants\+: ``` \section*{Backup-\/and-\/\+Restore\+:/examples/mathcheck}

kdb mount mathcheck.\+dump /examples/mathcheck dump mathcheck kdb setmeta user/examples/mathcheck/k check/math \char`\"{}\+:= + ../a '5'\char`\"{} kdb set /examples/mathcheck/a 5.\+5 kdb get /examples/mathcheck/k 10.\+5 kdb set /examples/mathcheck/a 8.\+0 kdb get /examples/mathcheck/k 13 kdb rm -\/r /examples/mathcheck kdb umount /examples/mathcheck ``` 