summary refs log tree commit diff stats
path: root/tests/lookups/test.nim
blob: dfacaf5b54842db7b869707005dad83b720a724f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
discard """
output: '''

[Suite] memoization
'''
"""

# 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) =
  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)