annotate src/testdir/test65.in @ 9070:0bb25b026fc9 v7.4.1820

commit https://github.com/vim/vim/commit/9ccaae04c6f263e6db14fc403bca2404a7871114 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 7 18:36:48 2016 +0200 patch 7.4.1820 Problem: Removing language from help tags too often. Solution: Only remove @en when not needed. (Hirohito Higashi)
author Christian Brabandt <cb@256bit.org>
date Sat, 07 May 2016 18:45:05 +0200
parents cd145cc2f2c9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3214
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
1 Test for floating point and logical operators.
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
2
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
3 STARTTEST
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
4 :so small.vim
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
5 :if !has("float")
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
6 : e! test.ok
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
7 : wq! test.out
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
8 :endif
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
9 :"
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
10 :$put =printf('%f', 123.456)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
11 :$put =printf('%e', 123.456)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
12 :$put =printf('%g', 123.456)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
13 :" check we don't crash on division by zero
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
14 :echo 1.0 / 0.0
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
15 :$put ='+='
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
16 :let v = 1.234
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
17 :let v += 6.543
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
18 :$put =printf('%g', v)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
19 :let v = 1.234
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
20 :let v += 5
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
21 :$put =printf('%g', v)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
22 :let a = 5
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
23 :let a += 3.333
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
24 :$put =string(a)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
25 :$put ='=='
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
26 :let v = 1.234
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
27 :$put =v == 1.234
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
28 :$put =v == 1.2341
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
29 :$put ='add-subtract'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
30 :$put =printf('%g', 4 + 1.234)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
31 :$put =printf('%g', 1.234 - 8)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
32 :$put ='mult-div'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
33 :$put =printf('%g', 4 * 1.234)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
34 :$put =printf('%g', 4.0 / 1234)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
35 :$put ='dict'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
36 :$put =string({'x': 1.234, 'y': -2.0e20})
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
37 :$put ='list'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
38 :$put =string([-123.4, 2.0e-20])
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
39 :$put ='abs'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
40 :$put =printf('%d', abs(1456))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
41 :$put =printf('%d', abs(-4))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
42 :$put =printf('%d', abs([1, 2, 3]))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
43 :$put =printf('%g', abs(14.56))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
44 :$put =printf('%g', abs(-54.32))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
45 :$put ='ceil'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
46 :$put =printf('%g', ceil(1.456))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
47 :$put =printf('%g', ceil(-5.456))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
48 :$put =printf('%g', ceil(-4.000))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
49 :$put ='floor'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
50 :$put =printf('%g', floor(1.856))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
51 :$put =printf('%g', floor(-5.456))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
52 :$put =printf('%g', floor(4.0))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
53 :$put ='log10'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
54 :$put =printf('%g', log10(1000))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
55 :$put =printf('%g', log10(0.01000))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
56 :$put ='pow'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
57 :$put =printf('%g', pow(3, 3.0))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
58 :$put =printf('%g', pow(2, 16))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
59 :$put ='round'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
60 :$put =printf('%g', round(0.456))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
61 :$put =printf('%g', round(4.5))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
62 :$put =printf('%g', round(-4.50))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
63 :$put ='sqrt'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
64 :$put =printf('%g', sqrt(100))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
65 :echo sqrt(-4.01)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
66 :$put ='str2float'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
67 :$put =printf('%g', str2float('1e40'))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
68 :$put ='trunc'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
69 :$put =printf('%g', trunc(1.456))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
70 :$put =printf('%g', trunc(-5.456))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
71 :$put =printf('%g', trunc(4.000))
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
72 :$put ='float2nr'
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
73 :$put =float2nr(123.456)
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
74 :$put =float2nr(-123.456)
3214
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
75 :$put ='AND'
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
76 :$put =and(127, 127)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
77 :$put =and(127, 16)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
78 :$put =and(127, 128)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
79 :$put ='OR'
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
80 :$put =or(16, 7)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
81 :$put =or(8, 7)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
82 :$put =or(0, 123)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
83 :$put ='XOR'
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
84 :$put =xor(127, 127)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
85 :$put =xor(127, 16)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
86 :$put =xor(127, 128)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
87 :$put ='invert'
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
88 :$put =and(invert(127), 65535)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
89 :$put =and(invert(16), 65535)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
90 :$put =and(invert(128), 65535)
cd145cc2f2c9 updated for version 7.3.377
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
91 :$put =invert(1.0)
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
92 :/^Results/,$wq! test.out
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
93 ENDTEST
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
94
18ee39301b82 updated for version 7.2a
vimboss
parents: 1604
diff changeset
95 Results of test65: