This will define a function named setAlarm. It takes three parameters. Which are all three booleans.
case(employed,onVacation)of
We wrap our two parameters into a tuple. That way we can easily work with pattern matching.
Tests
moduleSetAlarmTestexposing(suite)importExpectexposing(equal)importSetAlarmexposing(setAlarm)importTestexposing(Test,describe,test)suite:Testsuite=describe"Set alarm"[test"It should return true when employed and not on vacation"<|\_->equalTrue<|setAlarmTrueFalse,test"It should return true when unemployed and not on vacation"<|\_->equalFalse<|setAlarmFalseFalse,test"It should return true when employed and on vacation"<|\_->equalFalse<|setAlarmTrueTrue,test"It should return true when unemployed and on vacation"<|\_->equalFalse<|setAlarmFalseTrue]
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Elm
Explainations
This will expose our only function
setAlarm
to the outside world (used in our tests, see below).This will define a function named
setAlarm
. It takes three parameters. Which are all three booleans.We wrap our two parameters into a tuple. That way we can easily work with pattern matching.
Tests