Skip to main content

Nim

Versions

  • 1.6

Test Frameworks

unittest

Tests are currently executed using the following:

# tests.nim
import unittest, codewars_output
addOutputFormatter(OutputFormatter(newCodewarsOutputFormatter()))
import solution
include solution_tests
# tests.nim
import unittest, codewars_output
addOutputFormatter(OutputFormatter(newCodewarsOutputFormatter()))
import solution
include solution_tests

The custom output formatter is open sourced at codewars/nim-unittest.

Using Preloaded Code

Preloaded

proc f*(x, y: int): int = x + y
proc f*(x, y: int): int = x + y

Solution

import setup # required
proc add*(x, y, z: int): int = f(x, y) + z
import setup # required
proc add*(x, y, z: int): int = f(x, y) + z

Tests

suite "add(x, y, z) using preloaded f(x, y)":
  test "works":
    check(add(1, 1, 1) == 3)
suite "add(x, y, z) using preloaded f(x, y)":
  test "works":
    check(add(1, 1, 1) == 3)

Timeout

12 seconds

Packages

None

Services

None

Language ID

nim