Skip to content

Language Julia

kazk edited this page Jun 16, 2020 · 4 revisions

Status

Beta

Versions

  • 1.0

Test Frameworks

FactCheck

Minimum Example

module Adder
  export add
  function add(a, b)
    a + b
  end
end
using FactCheck
facts("add") do
  @fact Adder.add(1, 1) --> 2
end

With Random Tests

using FactCheck
using .Solution

facts("multiply") do
  context("fixed tests") do
    @fact multiply(2, 2) --> 4
    @fact multiply(1, 1) --> 1
    @fact multiply(3, 2) --> 6
  end

  context("random tests") do
    for _ = 1:100
      a = rand(-100:100)
      b = rand(-100:100)
      # Note that the string after the assertions is for custom error message,
      # but used as test case name on Codewars.
      @fact multiply(a, b) --> a*b "multiply($(a), $(b))"
    end
  end
end

Timeout

12 seconds

Packages

None

Services

None

Language ID

julia

Clone this wiki locally