• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#**
2
3@test arithmetic.vm
4
5This template is used for Velocity regression testing.
6If you alter this template make sure you change the
7corresponding comparison file so that the regression
8test doesn't fail incorrectly.
9
10*#
11
12#set($foo = 5)
13#set($foo = $foo + 1)
14$foo
15
16#set($foo = $foo - 1)
17$foo
18
19#set($foo = $foo * 2)
20$foo
21
22#set($foo = $foo / 2)
23$foo
24
25Check the decimal literals
26#set($bar = 4.5e3)
27$bar
28
29#set($bar = 4.5e+3)
30$bar
31
32#set($bar = 4.5e-3)
33$bar
34
35#set($bar = 4.5e055)
36$bar
37
38#set($bar = 4.5)
39$bar
40
41#set($bar = $bar + 1)
42$bar
43
44#set($tbar = $bar * 2)
45$tbar
46
47Check that the system can handle integers greater than Integer.MAX_INT
48#set($baba = 100000000000)
49$baba
50
51#set($baba = $baba + 1)
52$baba
53
54#set ($foo = $foo / 2)
55$foo
56
57## now lets try some string concatenation
58
59#set($stringy = "This is a very long string"
60 + " that we are breaking up into multiple"
61 + " lines for testing."
62)
63$stringy
64
65#set($stringy = "This is a string. The number 2 = " + 2)
66$stringy
67
68#set($three = 3)
69#set($stringy = "This is a string."
70+ " The value = "
71+ $three
72)
73$stringy
74