-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vimscript/reverse-string: 1st iteration
- Loading branch information
Showing
10 changed files
with
261 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!coverage.py: This is a private format, don't read it directly!{"lines":{"/home/vpayno/git_vpayno/exercism-workspace/vimscript/reverse-string/reverse_string.vim":[9]},"file_tracers":{"/home/vpayno/git_vpayno/exercism-workspace/vimscript/reverse-string/reverse_string.vim":"covimerage.CoveragePlugin"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[run] | ||
plugins = covimerage | ||
data_file = .coverage_covimerage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
" .themisrc | ||
|
||
let g:repo_root = fnamemodify(expand('<sfile>'), ':h:h') | ||
|
||
call themis#option('exclude', g:repo_root . '/*.md') | ||
call themis#option('exclude', g:repo_root . '/*.vader') | ||
call themis#option('exclude', g:repo_root . '/*.txt') | ||
call themis#helper('command').with(themis#helper('assert')) | ||
|
||
if $PROFILE_LOG !=# '' | ||
execute 'profile' 'start' $PROFILE_LOG | ||
execute 'profile!' 'file' g:repo_root . '/*.vim' | ||
endif | ||
|
||
call themis#option('runtimepath', expand(g:repo_root)) | ||
|
||
" vim:ft=vim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" ?> | ||
<coverage branch-rate="0" branches-covered="0" branches-valid="0" complexity="0" line-rate="0.2" lines-covered="1" lines-valid="5" timestamp="1712851156142" version="4.5.4"> | ||
<!-- Generated by coverage.py: https://coverage.readthedocs.io --> | ||
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd --> | ||
<sources> | ||
<source>/home/vpayno/git_vpayno/exercism-workspace/vimscript/reverse-string</source> | ||
</sources> | ||
<packages> | ||
<package branch-rate="0" complexity="0" line-rate="0.2" name="."> | ||
<classes> | ||
<class branch-rate="0" complexity="0" filename="reverse_string.vim" line-rate="0.2" name="reverse_string.vim"> | ||
<methods/> | ||
<lines> | ||
<line hits="1" number="9"/> | ||
<line hits="0" number="10"/> | ||
<line hits="0" number="12"/> | ||
<line hits="0" number="13"/> | ||
<line hits="0" number="16"/> | ||
</lines> | ||
</class> | ||
</classes> | ||
</package> | ||
</packages> | ||
</coverage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
SCRIPT /home/vpayno/git_vpayno/exercism-workspace/vimscript/reverse-string/reverse_string.vim | ||
Sourced 1 time | ||
Total time: 0.000013581 | ||
Self time: 0.000013581 | ||
|
||
count total (s) self (s) | ||
" | ||
" Reverses the passed test | ||
" | ||
" Examples: | ||
" | ||
" :echo Reverse('Exercism') | ||
" msicrexE | ||
" | ||
1 0.000002889 function! Reverse(text) abort | ||
let l:rtext = '' | ||
|
||
for s:item in split(a:text, '\zs') | ||
let l:rtext = s:item . l:rtext | ||
endfor | ||
|
||
return l:rtext | ||
endfunction | ||
|
||
FUNCTION Reverse() | ||
Defined: ~/git_vpayno/exercism-workspace/vimscript/reverse-string/reverse_string.vim:9 | ||
Called 6 times | ||
Total time: 0.000140630 | ||
Self time: 0.000140630 | ||
|
||
count total (s) self (s) | ||
6 0.000026721 let l:rtext = '' | ||
|
||
40 0.000046056 for s:item in split(a:text, '\zs') | ||
34 0.000035614 let l:rtext = s:item . l:rtext | ||
40 0.000014829 endfor | ||
|
||
6 0.000004430 return l:rtext | ||
|
||
FUNCTIONS SORTED ON TOTAL TIME | ||
count total (s) self (s) function | ||
6 0.000140630 Reverse() | ||
|
||
FUNCTIONS SORTED ON SELF TIME | ||
count total (s) self (s) function | ||
6 0.000140630 Reverse() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
" themis.vimspec | ||
|
||
let s:suite = themis#suite('thesis tests') | ||
let s:assert = themis#helper('assert') | ||
|
||
source *.vim | ||
|
||
let g:test_cases = { | ||
\ '': '', | ||
\ 'robot': 'tobor', | ||
\ 'Ramen': 'nemaR', | ||
\ 'I''m hungry!': '!yrgnuh m''I', | ||
\ 'racecar': 'racecar', | ||
\ 'drawer': 'reward' | ||
\ } | ||
|
||
" The function name(my_test_1) will be a test name. | ||
function s:suite.test_reverse_string() | ||
let l:forward = 0 | ||
let l:backward = 0 | ||
|
||
for l:key in keys(g:test_cases) | ||
let l:forward = l:key | ||
let l:backward = g:test_cases[l:key] | ||
|
||
let l:got = Reverse(l:forward) | ||
let l:want = l:backward | ||
|
||
" appending the number to the want/got values to make it easier to debug failures | ||
call s:assert.equals(l:forward . ':' . l:want, l:forward . ':' . l:got) | ||
endfor | ||
endfunction | ||
|
||
" vim: ft=vim |