Family Day update
This commit is contained in:
parent
aac6731f2c
commit
9ad63ea473
2442 changed files with 39761 additions and 8255 deletions
15
Task/Test-a-function/Crystal/test-a-function.crystal
Normal file
15
Task/Test-a-function/Crystal/test-a-function.crystal
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
require "spec"
|
||||
|
||||
describe "palindrome" do
|
||||
it "returns true for a word that's palindromic" do
|
||||
palindrome("racecar").should be_true
|
||||
end
|
||||
|
||||
it "returns false for a word that's not palindromic" do
|
||||
palindrome("goodbye").should be_false
|
||||
end
|
||||
end
|
||||
|
||||
def palindrome(s)
|
||||
s == s.reverse
|
||||
end
|
||||
8
Task/Test-a-function/Prolog/test-a-function.pro
Normal file
8
Task/Test-a-function/Prolog/test-a-function.pro
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
palindrome(Word) :- name(Word,List), reverse(List,List).
|
||||
|
||||
:- begin_tests(palindrome).
|
||||
|
||||
test(valid_palindrome) :- palindrome('ingirumimusnocteetconsumimurigni').
|
||||
test(invalid_palindrome, [fail]) :- palindrome('this is not a palindrome').
|
||||
|
||||
:- end_tests(palindrome).
|
||||
Loading…
Add table
Add a link
Reference in a new issue