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
|
%prep
autoload -Uz zmathfunc && zmathfunc
%test
echo $(( min(42, 43) )) $(( max(42, 43) )) $(( sum(42, 43) ))
echo $(( min(42) )) $(( max(42) )) $(( sum(42) ))
echo $(( sum() ))
0:basic functionality test
>42 43 85
>42 42 42
>0
(set -e; echo $(( min(0, 42) )))
(set -e; echo $(( max(0, -42) )))
(set -e; echo $(( sum(42, -42) )))
0:regression test for ERR_EXIT
>0
>0
>0
echo $(( min(42, 43, 44) ))
echo $(( min(44, 42, 43) ))
echo $(( min(43, 44, 42) ))
#
echo $(( max(42, 43, 44) ))
echo $(( max(44, 42, 43) ))
echo $(( max(43, 44, 42) ))
0:min() and max() with three arguments
>42
>42
>42
>44
>44
>44
echo $(( min() ))
1:error test for min()
?(eval):1: wrong number of arguments: min()
echo $(( max() ))
1:error test for max()
?(eval):1: wrong number of arguments: max()
%clean
|