Test a function: Difference between revisions

Add Julia language
(→‎{{header|Kotlin}}: Improved example)
(Add Julia language)
Line 793:
Then the tests can be run by invoking jq in the usual way:
<lang sh>jq --run-tests < test-library.txt</lang>
 
=={{header|Julia}}==
{{works with|Julia|0.6}}
 
<lang julia>using Base.Test
include("Palindrome_detection.jl")
 
# Simple test
@test palindrome("abcdcba")
@test !palindrome("abd")
 
# Test sets
@testset "palindromes" begin
@test palindrome("aaaaa")
@test palindrome("abcba")
@test palindrome("1")
@test palindrome("12321")
end
 
@testset "non-palindromes" begin
@test !palindrome("abc")
@test !palindrome("a11")
@test !palindrome("012")
end</lang>
 
{{out}}
<pre>Test Summary: | Pass Total
palindromes | 4 4
Test Summary: | Pass Total
non-palindromes | 3 3</pre>
 
=={{header|Kotlin}}==
Anonymous user