summary refs log tree commit diff stats
path: root/tests/lookups/test.nim
blob: a17d235a4e32e9d5e6af39a2c4140535e833eeec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)