forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmathcheck.esr
123 lines (73 loc) · 2.08 KB
/
mathcheck.esr
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
Mountpoint: user:/tests/mathcheck
DiffType: File
File: mathcheck.esr
Storage: mathcheck
# Setup
< kdb mount $File $Mountpoint $Storage ni
# Test ../
< kdb set $Mountpoint/check/test0/points 5.9
< kdb set $Mountpoint/check/test1/points 4.5
< kdb set $Mountpoint/check/gp
< kdb meta-set $Mountpoint/check/gp check/math ":= + ../test0/points ../test1/points"
STDOUT: 10.4
< kdb get $Mountpoint/check/gp
RET: 0
< kdb rm -r $Mountpoint
# Test ./
< kdb set $Mountpoint/check/gp/test0/points 5.9
< kdb set $Mountpoint/check/gp/test1/points 4.5
< kdb set $Mountpoint/check/gp
< kdb meta-set $Mountpoint/check/gp check/math ":= + ./test0/points ./test1/points"
STDOUT: 10.4
< kdb get $Mountpoint/check/gp
RET: 0
< kdb rm -r $Mountpoint
# Test @/
< kdb set $Mountpoint/check/test0/points 5.9
< kdb set $Mountpoint/check/test1/points 4.5
< kdb set $Mountpoint/check/gp
< kdb meta-set $Mountpoint/check/gp check/math ":= + @/check/test0/points @/check/test1/points"
STDOUT: 10.4
< kdb get $Mountpoint/check/gp
RET: 0
< kdb rm -r $Mountpoint
# Test Null sum
< kdb set $Mountpoint/key0 5
< kdb set $Mountpoint/sum
< kdb meta-set $Mountpoint/sum check/math ":= + @/key0 @/key1"
STDOUT: 5
< kdb get $Mountpoint/sum
RET: 0
< kdb rm -r $Mountpoint
# Test Null sub
< kdb set $Mountpoint/key0 5
< kdb set $Mountpoint/sub
< kdb meta-set $Mountpoint/sub check/math ":= - @/key0 @/key1"
STDOUT: 5
< kdb get $Mountpoint/sub
RET: 0
< kdb rm -r $Mountpoint
# Test Null mul
< kdb set $Mountpoint/key0 5
< kdb set $Mountpoint/mul
< kdb meta-set $Mountpoint/mul check/math ":= * @/key0 @/key1"
STDOUT: 5
< kdb get $Mountpoint/mul
RET: 0
< kdb rm -r $Mountpoint
# Test Null div
< kdb set $Mountpoint/key0 5
< kdb set $Mountpoint/div
< kdb meta-set $Mountpoint/div check/math ":= / @/key0 @/key1"
STDOUT: 5
< kdb get $Mountpoint/div
< kdb set $Mountpoint/check/a 3.1
< kdb set $Mountpoint/check/b 4.5
< kdb set $Mountpoint/check/k 7.6
< kdb meta-set $Mountpoint/check/k check/math "== + ../a ../b"
ERROR: C03200
< kdb set $Mountpoint/check/k 7.7
RET: 0
< kdb rm -r $Mountpoint
# Cleanup
< kdb umount $Mountpoint