mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
* fix megatest newlines * still allow missing trailing newline for now but in a more strict way than before
24 lines
395 B
Nim
24 lines
395 B
Nim
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)
|