Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
narimiran committed Oct 14, 2019
1 parent c4999a7 commit 7aaac13
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 12 deletions.
143 changes: 143 additions & 0 deletions Session.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
let SessionLoad = 1
let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
let v:this_session=expand("<sfile>:p")
silent only
cd ~/nim-lang/Nim
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
let s:wipebuf = bufnr('%')
endif
set shortmess=aoO
badd +1758 lib/pure/os.nim
badd +957 term://.//7705:/usr/bin/fish
badd +2572 lib/system.nim
badd +73 doc/contributing.rst
badd +1 ~/nim-lang/Nim
badd +1 ~/
badd +789 term://.//11208:/usr/bin/fish
badd +28 term://.//20180:/usr/bin/fish
badd +8 .git/rebase-merge/git-rebase-todo
badd +66 testament/testament.nim
badd +67 testament/specs.nim
badd +1 ~/dotfiles/neovim/.config/nvim
badd +1 doc
badd +1 packages.json
badd +0 probapackages/packages.json
badd +1 testament/important_packages.nim
badd +1 proba.nim
argglobal
silent! argdel *
$argadd \*.ml
edit probapackages/packages.json
set splitbelow splitright
wincmd _ | wincmd |
vsplit
wincmd _ | wincmd |
vsplit
2wincmd h
wincmd w
wincmd w
wincmd _ | wincmd |
split
1wincmd k
wincmd w
wincmd t
set winminheight=0
set winheight=1
set winminwidth=0
set winwidth=1
exe 'vert 1resize ' . ((&columns * 127 + 191) / 382)
exe 'vert 2resize ' . ((&columns * 127 + 191) / 382)
exe '3resize ' . ((&lines * 36 + 37) / 75)
exe 'vert 3resize ' . ((&columns * 126 + 191) / 382)
exe '4resize ' . ((&lines * 36 + 37) / 75)
exe 'vert 4resize ' . ((&columns * 126 + 191) / 382)
argglobal
setlocal fdm=manual
setlocal fde=0
setlocal fmr={{{,}}}
setlocal fdi=#
setlocal fdl=0
setlocal fml=1
setlocal fdn=20
setlocal nofen
silent! normal! zE
let s:l = 15790 - ((31 * winheight(0) + 36) / 73)
if s:l < 1 | let s:l = 1 | endif
exe s:l
normal! zt
15790
normal! 013|
lcd ~/nim-lang/Nim
wincmd w
argglobal
if bufexists('~/nim-lang/Nim/testament/important_packages.nim') | buffer ~/nim-lang/Nim/testament/important_packages.nim | else | edit ~/nim-lang/Nim/testament/important_packages.nim | endif
setlocal fdm=indent
setlocal fde=0
setlocal fmr={{{,}}}
setlocal fdi=
setlocal fdl=0
setlocal fml=1
setlocal fdn=20
setlocal nofen
let s:l = 1 - ((0 * winheight(0) + 36) / 73)
if s:l < 1 | let s:l = 1 | endif
exe s:l
normal! zt
1
normal! 0
wincmd w
argglobal
if bufexists('~/nim-lang/Nim/proba.nim') | buffer ~/nim-lang/Nim/proba.nim | else | edit ~/nim-lang/Nim/proba.nim | endif
setlocal fdm=indent
setlocal fde=0
setlocal fmr={{{,}}}
setlocal fdi=
setlocal fdl=0
setlocal fml=1
setlocal fdn=20
setlocal nofen
let s:l = 1 - ((0 * winheight(0) + 18) / 36)
if s:l < 1 | let s:l = 1 | endif
exe s:l
normal! zt
1
normal! 0
wincmd w
argglobal
if bufexists('term://.//7705:/usr/bin/fish') | buffer term://.//7705:/usr/bin/fish | else | edit term://.//7705:/usr/bin/fish | endif
setlocal fdm=manual
setlocal fde=0
setlocal fmr={{{,}}}
setlocal fdi=#
setlocal fdl=0
setlocal fml=1
setlocal fdn=20
setlocal nofen
let s:l = 957 - ((15 * winheight(0) + 18) / 36)
if s:l < 1 | let s:l = 1 | endif
exe s:l
normal! zt
957
normal! 044|
wincmd w
2wincmd w
exe 'vert 1resize ' . ((&columns * 127 + 191) / 382)
exe 'vert 2resize ' . ((&columns * 127 + 191) / 382)
exe '3resize ' . ((&lines * 36 + 37) / 75)
exe 'vert 3resize ' . ((&columns * 126 + 191) / 382)
exe '4resize ' . ((&lines * 36 + 37) / 75)
exe 'vert 4resize ' . ((&columns * 126 + 191) / 382)
tabnext 1
if exists('s:wipebuf') && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
silent exe 'bwipe ' . s:wipebuf
endif
unlet! s:wipebuf
set winheight=1 winwidth=20 winminheight=1 winminwidth=1 shortmess=filnxtToOFc
let s:sx = expand("<sfile>:p:r")."x.vim"
if file_readable(s:sx)
exe "source " . fnameescape(s:sx)
endif
let &so = s:so_save | let &siso = s:siso_save
doautoall SessionLoadPost
unlet SessionLoad
" vim: set ft=vim :
4 changes: 2 additions & 2 deletions lib/pure/collections/sets.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1019,9 +1019,9 @@ when isMainModule and not defined(release):
# --> {1, 3, 5}

block toSeqAndString:
var a = toHashSet([2, 4, 5])
var a = toHashSet([2, 7, 5])
var b = initHashSet[int]()
for x in [2, 4, 5]: b.incl(x)
for x in [2, 7, 5]: b.incl(x)
assert($a == $b)
#echo a
#echo toHashSet(["no", "esc'aping", "is \" provided"])
Expand Down
14 changes: 7 additions & 7 deletions lib/pure/hashes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -113,31 +113,31 @@ proc hash*[T: proc](x: T): Hash {.inline.} =
result = hash(pointer(x))

const
prime = 31
prime = uint(11)

proc hash*(x: int): Hash {.inline.} =
## Efficient hashing of integers.
result = x * prime
result = cast[Hash](cast[uint](x) * prime)

proc hash*(x: int64): Hash {.inline.} =
## Efficient hashing of `int64` integers.
result = cast[int](x) * prime
result = cast[Hash](cast[uint](x) * prime)

proc hash*(x: uint): Hash {.inline.} =
## Efficient hashing of unsigned integers.
result = cast[int](x) * prime
result = cast[Hash](x * prime)

proc hash*(x: uint64): Hash {.inline.} =
## Efficient hashing of `uint64` integers.
result = cast[int](x) * prime
result = cast[Hash](cast[uint](x) * prime)

proc hash*(x: char): Hash {.inline.} =
## Efficient hashing of characters.
result = ord(x) * prime
result = cast[Hash](cast[uint](ord(x)) * prime)

proc hash*[T: Ordinal](x: T): Hash {.inline.} =
## Efficient hashing of other ordinal types (e.g. enums).
result = ord(x) * prime
result = cast[Hash](cast[uint](ord(x)) * prime)

proc hash*(x: float): Hash {.inline.} =
## Efficient hashing of floats.
Expand Down
4 changes: 2 additions & 2 deletions tests/collections/ttables.nim
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ block tablesref:
for y in 0..1:
assert t[(x,y)] == $x & $y
assert($t ==
"{(x: 0, y: 1): \"01\", (x: 0, y: 0): \"00\", (x: 1, y: 0): \"10\", (x: 1, y: 1): \"11\"}")
"{(x: 1, y: 1): \"11\", (x: 0, y: 0): \"00\", (x: 0, y: 1): \"01\", (x: 1, y: 0): \"10\"}")

block tableTest2:
var t = newTable[string, float]()
Expand Down Expand Up @@ -340,7 +340,7 @@ block tablesref:
block anonZipTest:
let keys = @['a','b','c']
let values = @[1, 2, 3]
doAssert "{'a': 1, 'b': 2, 'c': 3}" == $ toTable zip(keys, values)
doAssert "{'c': 3, 'a': 1, 'b': 2}" == $ toTable zip(keys, values)

block clearTableTest:
var t = newTable[string, float]()
Expand Down
2 changes: 1 addition & 1 deletion tests/collections/ttablesthreads.nim
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ block tableTest1:
for y in 0..1:
assert t[(x,y)] == $x & $y
assert($t ==
"{(x: 0, y: 1): \"01\", (x: 0, y: 0): \"00\", (x: 1, y: 0): \"10\", (x: 1, y: 1): \"11\"}")
"{(x: 1, y: 1): \"11\", (x: 0, y: 0): \"00\", (x: 0, y: 1): \"01\", (x: 1, y: 0): \"10\"}")

block tableTest2:
var t = initTable[string, float]()
Expand Down

0 comments on commit 7aaac13

Please sign in to comment.