Mercurial > vim
view src/testdir/test65.in @ 10338:e8a6a3bbd212 v8.0.0064
commit https://github.com/vim/vim/commit/eb828d01d9c91791fa1fe217ba651cdc25746d1b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Nov 5 19:54:01 2016 +0100
patch 8.0.0064
Problem: Normal test fails on MS-Windows.
Solution: Don't try using an illegal file name.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 05 Nov 2016 20:00:04 +0100 |
parents | cd145cc2f2c9 |
children |
line wrap: on
line source
Test for floating point and logical operators. STARTTEST :so small.vim :if !has("float") : e! test.ok : wq! test.out :endif :" :$put =printf('%f', 123.456) :$put =printf('%e', 123.456) :$put =printf('%g', 123.456) :" check we don't crash on division by zero :echo 1.0 / 0.0 :$put ='+=' :let v = 1.234 :let v += 6.543 :$put =printf('%g', v) :let v = 1.234 :let v += 5 :$put =printf('%g', v) :let a = 5 :let a += 3.333 :$put =string(a) :$put ='==' :let v = 1.234 :$put =v == 1.234 :$put =v == 1.2341 :$put ='add-subtract' :$put =printf('%g', 4 + 1.234) :$put =printf('%g', 1.234 - 8) :$put ='mult-div' :$put =printf('%g', 4 * 1.234) :$put =printf('%g', 4.0 / 1234) :$put ='dict' :$put =string({'x': 1.234, 'y': -2.0e20}) :$put ='list' :$put =string([-123.4, 2.0e-20]) :$put ='abs' :$put =printf('%d', abs(1456)) :$put =printf('%d', abs(-4)) :$put =printf('%d', abs([1, 2, 3])) :$put =printf('%g', abs(14.56)) :$put =printf('%g', abs(-54.32)) :$put ='ceil' :$put =printf('%g', ceil(1.456)) :$put =printf('%g', ceil(-5.456)) :$put =printf('%g', ceil(-4.000)) :$put ='floor' :$put =printf('%g', floor(1.856)) :$put =printf('%g', floor(-5.456)) :$put =printf('%g', floor(4.0)) :$put ='log10' :$put =printf('%g', log10(1000)) :$put =printf('%g', log10(0.01000)) :$put ='pow' :$put =printf('%g', pow(3, 3.0)) :$put =printf('%g', pow(2, 16)) :$put ='round' :$put =printf('%g', round(0.456)) :$put =printf('%g', round(4.5)) :$put =printf('%g', round(-4.50)) :$put ='sqrt' :$put =printf('%g', sqrt(100)) :echo sqrt(-4.01) :$put ='str2float' :$put =printf('%g', str2float('1e40')) :$put ='trunc' :$put =printf('%g', trunc(1.456)) :$put =printf('%g', trunc(-5.456)) :$put =printf('%g', trunc(4.000)) :$put ='float2nr' :$put =float2nr(123.456) :$put =float2nr(-123.456) :$put ='AND' :$put =and(127, 127) :$put =and(127, 16) :$put =and(127, 128) :$put ='OR' :$put =or(16, 7) :$put =or(8, 7) :$put =or(0, 123) :$put ='XOR' :$put =xor(127, 127) :$put =xor(127, 16) :$put =xor(127, 128) :$put ='invert' :$put =and(invert(127), 65535) :$put =and(invert(16), 65535) :$put =and(invert(128), 65535) :$put =invert(1.0) :/^Results/,$wq! test.out ENDTEST Results of test65: