Skip to content

Instantly share code, notes, and snippets.

@jeffutter

jeffutter/error Secret

Created October 8, 2019 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffutter/ebe4f1c6efb94cf57eabffa5d2fd9e42 to your computer and use it in GitHub Desktop.
Save jeffutter/ebe4f1c6efb94cf57eabffa5d2fd9e42 to your computer and use it in GitHub Desktop.
/usr/local/Cellar/nim/1.0.0/nim/lib/pure/unittest.nim(631, 43) Error: type mismatch: got <array[0..-1, empty], int literal(1)>
but expected one of:
proc binarySearch[T, K](a: openArray[T]; key: K;
cmp: proc (x: T; y: K): int {.closure.}): int
first type mismatch at position: 3
missing parameter: cmp
proc binarySearch[T](a: openArray[T]; key: T): int
first type mismatch at position: 2
required type for key: T
but expression '1' is of type: int literal(1)
expression: binarySearch([], 1)
import unittest
import algorithm
suite "Binary Search":
test "not found":
check binarySearch([], 1) == -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment