-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrobberlanguage-spec.sml
More file actions
33 lines (26 loc) · 1.11 KB
/
robberlanguage-spec.sml
File metadata and controls
33 lines (26 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
CM.make "../describe.cm";
open Describe;
open Expect;
use "../example-src/robberlanguage.sml";
suite (describe "RobberLanguage" [
describe "isConsonant"
[should("consider b to be a consonant", fn () =>
expect (RobberLanguage.isConsonant #"b") toBe true),
should("consider capital letters as consonants", fn () =>
expect (RobberLanguage.isConsonant #"B") toBe true),
should("not consider vowels as consonants", fn () =>
expect (RobberLanguage.isConsonant #"a") toBe false)],
describe "translate"
[should("repeat consonant with the letter o inserted in between", fn () =>
expect (RobberLanguage.translate "s")
toBeStr "sos"),
should("not repeat vowels", fn () =>
expect (RobberLanguage.translate "a")
toHaveSize 1),
should("work for long strings", fn () =>
expect (RobberLanguage.translate "a long string")
toMatch "lolonongog"),
should("repeat capital consonants as lower case", fn () =>
expect (RobberLanguage.translate "Astrid Lindgren")
toEqualStr "Asostotroridod Lolinondodgogrorenon")]
])