Files
Nim/tests/lookups/test.nim
Andreas Rumpf de6198c747 fixes #4555
2016-08-02 12:47:02 +02:00

18 lines
349 B
Nim

# This file needs to be called 'test' nim to provoke a clash
# with the unittest.test name. Issue #
import unittest, macros
# bug #4555
macro memo(n: untyped): typed =
result = n
proc fastFib(n: int): int {.memo.} = 40
proc fib(n: int): int = 40
suite "memoization":
test "recursive function memoization":
check fastFib(40) == fib(40)