-
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.
- Loading branch information
Showing
10 changed files
with
288 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ | |
|
||
- [hello-world](./hello-world/README.md) | ||
- [raindrops](./raindrops/README.md) | ||
- [leap](./leap/README.md) |
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/leap/leap.vim":[5]},"file_tracers":{"/home/vpayno/git_vpayno/exercism-workspace/vimscript/leap/leap.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,29 @@ | ||
<?xml version="1.0" ?> | ||
<coverage branch-rate="0" branches-covered="0" branches-valid="0" complexity="0" line-rate="0.1" lines-covered="1" lines-valid="10" timestamp="1712714319679" 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/leap</source> | ||
</sources> | ||
<packages> | ||
<package branch-rate="0" complexity="0" line-rate="0.1" name="."> | ||
<classes> | ||
<class branch-rate="0" complexity="0" filename="leap.vim" line-rate="0.1" name="leap.vim"> | ||
<methods/> | ||
<lines> | ||
<line hits="1" number="5"/> | ||
<line hits="0" number="7"/> | ||
<line hits="0" number="8"/> | ||
<line hits="0" number="10"/> | ||
<line hits="0" number="11"/> | ||
<line hits="0" number="14"/> | ||
<line hits="0" number="15"/> | ||
<line hits="0" number="18"/> | ||
<line hits="0" number="19"/> | ||
<line hits="0" number="22"/> | ||
</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
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,63 @@ | ||
SCRIPT /home/vpayno/git_vpayno/exercism-workspace/vimscript/leap/leap.vim | ||
Sourced 1 time | ||
Total time: 0.000014876 | ||
Self time: 0.000014876 | ||
|
||
count total (s) self (s) | ||
" | ||
" This function takes a year and returns 1 if it's a leap year | ||
" and 0 otherwise. | ||
" | ||
1 0.000002322 function! LeapYear(year) abort | ||
" the tests want 0->false, 1->true | ||
let l:true = 1 | ||
let l:false = 0 | ||
|
||
if a:year % 400 ==# 0 | ||
return l:true | ||
endif | ||
|
||
if a:year % 100 ==# 0 | ||
return l:false | ||
endif | ||
|
||
if a:year % 4 ==# 0 | ||
return l:true | ||
endif | ||
|
||
return l:false | ||
endfunction | ||
|
||
FUNCTION LeapYear() | ||
Defined: ~/git_vpayno/exercism-workspace/vimscript/leap/leap.vim:5 | ||
Called 5 times | ||
Total time: 0.000036833 | ||
Self time: 0.000036833 | ||
|
||
count total (s) self (s) | ||
" the tests want 0->false, 1->true | ||
5 0.000004532 let l:true = 1 | ||
5 0.000004432 let l:false = 0 | ||
|
||
5 0.000004906 if a:year % 400 ==# 0 | ||
1 0.000000720 return l:true | ||
4 0.000001581 endif | ||
|
||
4 0.000003105 if a:year % 100 ==# 0 | ||
2 0.000001574 return l:false | ||
2 0.000000666 endif | ||
|
||
2 0.000001496 if a:year % 4 ==# 0 | ||
1 0.000000686 return l:true | ||
1 0.000000338 endif | ||
|
||
1 0.000000711 return l:false | ||
|
||
FUNCTIONS SORTED ON TOTAL TIME | ||
count total (s) self (s) function | ||
5 0.000036833 LeapYear() | ||
|
||
FUNCTIONS SORTED ON SELF TIME | ||
count total (s) self (s) function | ||
5 0.000036833 LeapYear() | ||
|
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,33 @@ | ||
" themis.vimspec | ||
|
||
let s:suite = themis#suite('thesis tests') | ||
let s:assert = themis#helper('assert') | ||
|
||
source *.vim | ||
|
||
let g:test_cases = { | ||
\ '2015': 0, | ||
\ '1996': 1, | ||
\ '2100': 0, | ||
\ '2000': 1, | ||
\ '1800': 0 | ||
\ } | ||
|
||
" The function name(my_test_1) will be a test name. | ||
function s:suite.test_leapyear() | ||
let l:year = 0 | ||
let l:result = 0 | ||
|
||
for l:key in keys(g:test_cases) | ||
let l:year = str2nr(l:key) | ||
let l:result = g:test_cases[l:key] | ||
|
||
let l:got = LeapYear(l:year) | ||
let l:want = l:result | ||
|
||
" appending the number to the want/got values to make it easier to debug failures | ||
call s:assert.equals(l:year . ':' . l:want, l:year . ':' . l:got) | ||
endfor | ||
endfunction | ||
|
||
" vim: ft=vim |