-
Notifications
You must be signed in to change notification settings - Fork 222
Language Julia
kazk edited this page Jun 16, 2020
·
4 revisions
Beta
- 1.0
module Adder
export add
function add(a, b)
a + b
end
end
using FactCheck
facts("add") do
@fact Adder.add(1, 1) --> 2
end
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
12 seconds
None
None
julia