Skip to content

Instantly share code, notes, and snippets.

@itchyny
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itchyny/8e5f88f9e5c4700ff1d3 to your computer and use it in GitHub Desktop.
Save itchyny/8e5f88f9e5c4700ff1d3 to your computer and use it in GitHub Desktop.
profile start profile.log
profile func *strwidth*
set rtp+=/path/to/vital.vim/
let s:V = vital#of('vital')
let s:P = s:V.import('Prelude')
function! Error_strwidthpart()
endfunction
function! Test_strwidthpart()
let strmin = 0
let strmax = 300
let strstep = 5
let outmin = -10
let outmax = 300
let outstep = 5
for i in range(strmin, strmax, strstep)
let str = repeat('あa', i)
for j in range(outmin, outmax, outstep)
let out1 = s:P.strwidthpart(str, i)
let out2 = s:P.new_strwidthpart(str, i)
if out1 !=# out2
call Error_strwidthpart()
endif
let out1 = s:P.strwidthpart_reverse(str, i)
let out2 = s:P.new_strwidthpart_reverse(str, i)
if out1 !=# out2
call Error_strwidthpart()
endif
endfor
endfor
endfunction
call Test_strwidthpart()
exit
@itchyny
Copy link
Author

itchyny commented Jan 17, 2015

vim -u NONE -i NONE -N -e -s -S test.vim

profile result: https://gist.github.com/itchyny/21937d6847eb87f6104a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment