From a6d58bb6052ac8cb01805a48c4ad2f129126116f Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 24 Feb 2010 02:13:59 +0000 Subject: Added KDE3 version of kvirc git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1095341 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- doc/scriptexamples/exprtest.kvs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 doc/scriptexamples/exprtest.kvs (limited to 'doc/scriptexamples/exprtest.kvs') diff --git a/doc/scriptexamples/exprtest.kvs b/doc/scriptexamples/exprtest.kvs new file mode 100644 index 00000000..c07d199d --- /dev/null +++ b/doc/scriptexamples/exprtest.kvs @@ -0,0 +1,24 @@ +# A stresstest for the expression evaluation engine + +alias(exprtest) +{ + %txt = "Testing expression:" $0; + + %ret = ${ eval "return \$(" $0 ")"; } + if(%ret != $1) + { + %txt .= " ... Failed (return value" %ret "!=" $1")"; + echo %txt + } else { + %txt .= " ... Success (return value $1)"; + echo %txt + } +} + +exprtest "5 - 0 - 1" 4 +exprtest "5 - (0 - 1)" 6 +exprtest "2+3-5+3+1-2-3-8+5*3-2" 4 +exprtest "2*2 + 2*2 - 2*2" 4 +exprtest "-1" -1 +exprtest "--1--1" 2 +exprtest "-1+1" -2 -- cgit v1.2.1