Files
Nim/tests/vm/tsignaturehash.nim
ringabout afc30ca879 fixes #19863; move sha1, md5 to nimble packages for 2.0 (#21702)
* move sha1, md5 to nimble packages

* boot the compiler

* fixes tests

* build the documentation

* fixes docs

* lol, I forgot koch.nim

* add `nimHasChecksums` define

* clone checksums but maybe copying is better

* bump nimble hash

* use ChecksumsStableCommit

* fixes tests

* deprecate them

* fixes paths

* fixes koch
2023-05-02 10:49:17 +02:00

21 lines
568 B
Nim

# test sym digest is computable at compile time
import macros, algorithm
import ../../dist/checksums/src/checksums/md5
macro testmacro(s: typed{nkSym}): string =
let s = getMD5(signaturehash(s) & " - " & symBodyHash(s))
result = newStrLitNode(s)
macro testmacro(s: typed{nkOpenSymChoice|nkClosedSymChoice}): string =
var str = ""
for sym in s:
str &= symBodyHash(sym)
result = newStrLitNode(getMD5(str))
# something recursive and/or generic
discard testmacro(testmacro)
discard testmacro(`[]`)
discard testmacro(binarySearch)
discard testmacro(sort)