This commit is contained in:
Andreas Rumpf 2016-08-02 12:47:02 +02:00
commit de6198c747
8 changed files with 38 additions and 14 deletions

17
tests/lookups/test.nim Normal file
View file

@ -0,0 +1,17 @@
# 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)