geirm 00/12/27 06:29:08
Modified: test test.properties
Added: test/templates math.vm
test/templates/compare math.cmp
Log:
Added math.vm to test the integer math stuff.
Revision Changes Path
1.20 +1 -0 jakarta-velocity/test/test.properties
Index: test.properties
===================================================================
RCS file: /home/cvs/jakarta-velocity/test/test.properties,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- test.properties 2000/12/19 14:52:57 1.19
+++ test.properties 2000/12/27 14:29:05 1.20
@@ -32,3 +32,4 @@
test.template.30 = map
test.template.31 = literal
test.template.32 = ifstatement
+test.template.33 = math
1.1 jakarta-velocity/test/templates/math.vm
Index: math.vm
===================================================================
#*
@test escape.vm
This template is used for Velocity regression testing.
If you alter this template make sure you change the
corresponding comparison file so that the regression
test doesn't fail incorrectly.
Tests the basic integer math capabilities.
*#
Addition and subtraction :
#set($foo = 1)
#set($foo = $foo + 1)
1 + 1 = $foo
$foo - 1 = #set($foo = $foo - 1 )$foo
Multiplication, division, and modulus :
#set($bar = 5)
#set($rem = $bar % 2)
#set($rem2 = $bar % 0)
#set($rem3 = 7%2)
$bar % 2 = $rem
$bar % 0 = $rem2
7 % 2 = $rem3
$bar / 2 = #set($rem = $bar / 2 )$rem
$bar / 0 = #set($rem4 = $bar / 0 )$rem4
$bar * 2 = #set($rem = $bar * 2 )$rem
And now null nodes to make sure it doesn't throw an NPE :
#set($flargh=$woogie + $wabbie)
1.1 jakarta-velocity/test/templates/compare/math.cmp
Index: math.cmp
===================================================================
Addition and subtraction :
1 + 1 = 2
2 - 1 = 1
Multiplication, division, and modulus :
5 % 2 = 1
5 % 0 = $rem2
7 % 2 = 1
5 / 2 = 2
5 / 0 = $rem4
5 * 2 = 10
And now null nodes to make sure it doesn't throw an NPE :