blob: 56f39a4d7130f54224e4fb51135c6d03764fd6aa (
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): 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)
|