Fortran
Status
Beta
Versions
f2008with GFortran 9 (-std=f2008 -fall-intrinsics)
Test Frameworks
NOTE: Unlike other Codewars test frameworks, assertions take expected value first.
module Solution
implicit none
contains
function add(a, b)
integer(kind=4),intent(in)::a
integer(kind=4),intent(in)::b
integer(kind=4)::add
add = a + b
end function
end modulemodule Solution
implicit none
contains
function add(a, b)
integer(kind=4),intent(in)::a
integer(kind=4),intent(in)::b
integer(kind=4)::add
add = a + b
end function
end moduleprogram TestCases
use CW2
use Solution
implicit none
call assertEquals(2, add(1, 1))
end programprogram TestCases
use CW2
use Solution
implicit none
call assertEquals(2, add(1, 1))
end programModule names can be anything valid. Preloaded can be used to add another module.
Using describe and it:
program TestCases
use CW2
use Solution
implicit none
call describe("add")
call it("adds integers")
call assertEquals(2, add(1, 1))
call endContext()
call endContext()
end programprogram TestCases
use CW2
use Solution
implicit none
call describe("add")
call it("adds integers")
call assertEquals(2, add(1, 1))
call endContext()
call endContext()
end programTimeout
12 seconds
Packages
None
Services
None
Language ID
fortran