summaryrefslogtreecommitdiffstats
path: root/testsuite/buildok/stat_insert.stp
blob: 9915910baa0e31eb6611627d75452ca2cc328d23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#! stap -p4

# test the translatability of the statistic insertion operator

global loggy
global logmap
global liney
global linemap

global numbers
global strings

global x, y

function wibble()
{
	i = 0
	logmap[i++, "stewed"] <<< 1
	logmap[i++, "boiled"] <<< 1 + 2
	logmap[i++, "baked"] <<< (x = 0)
	logmap[i++, "fried"] <<< (x * (y=2)) + 3
}

function wobble()
{
	foreach (i in numbers)
	{
		foreach (j in strings)
		{
			linemap[strings[j],2*numbers[i],numbers[2*i]] <<< x * (y + i)
		}
	}
}


probe end {

	numbers[1] = 2
	numbers[2] = 5
	numbers[3] = 98279
	numbers[4] = 8739287

	strings[1] = "sun"
	strings[2] = "moon"
	strings[3] = "saturn"
	strings[4] = "venus"

	p = 4
	q = 5

	liney <<< 1
	liney <<< 1 + 2
	liney <<< p
	liney <<< (p * q) + 3

	loggy <<< 1
	loggy <<< 1 + 2
	loggy <<< p
	loggy <<< (p * q) + 3

	wibble()
	wobble()

}