aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/test/resources/templates/arithmetic.vm
diff options
context:
space:
mode:
Diffstat (limited to 'velocity-engine-core/src/test/resources/templates/arithmetic.vm')
-rw-r--r--velocity-engine-core/src/test/resources/templates/arithmetic.vm73
1 files changed, 73 insertions, 0 deletions
diff --git a/velocity-engine-core/src/test/resources/templates/arithmetic.vm b/velocity-engine-core/src/test/resources/templates/arithmetic.vm
new file mode 100644
index 00000000..de4366a6
--- /dev/null
+++ b/velocity-engine-core/src/test/resources/templates/arithmetic.vm
@@ -0,0 +1,73 @@
+#**
+
+@test arithmetic.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.
+
+*#
+
+#set($foo = 5)
+#set($foo = $foo + 1)
+$foo
+
+#set($foo = $foo - 1)
+$foo
+
+#set($foo = $foo * 2)
+$foo
+
+#set($foo = $foo / 2)
+$foo
+
+Check the decimal literals
+#set($bar = 4.5e3)
+$bar
+
+#set($bar = 4.5e+3)
+$bar
+
+#set($bar = 4.5e-3)
+$bar
+
+#set($bar = 4.5e055)
+$bar
+
+#set($bar = 4.5)
+$bar
+
+#set($bar = $bar + 1)
+$bar
+
+#set($tbar = $bar * 2)
+$tbar
+
+Check that the system can handle integers greater than Integer.MAX_INT
+#set($baba = 100000000000)
+$baba
+
+#set($baba = $baba + 1)
+$baba
+
+#set ($foo = $foo / 2)
+$foo
+
+## now lets try some string concatenation
+
+#set($stringy = "This is a very long string"
+ + " that we are breaking up into multiple"
+ + " lines for testing."
+)
+$stringy
+
+#set($stringy = "This is a string. The number 2 = " + 2)
+$stringy
+
+#set($three = 3)
+#set($stringy = "This is a string."
++ " The value = "
++ $three
+)
+$stringy