Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/iloveponies/tests/structured_data.clj
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
(title-length cities) => 21
(title-length wild-seed) => 9
(title-length little-schemer) => 18)

(facts "author-count" {:exercise 11
:points 1}
(author-count cities) => 1
Expand All @@ -155,7 +155,7 @@
(multiple-authors? cities) => false
(multiple-authors? wild-seed) => false
(multiple-authors? little-schemer) => true)

(facts "add-author" {:exercise 13
:points 1}
(add-author little-schemer {:name "Gerald J. Sussman"})
Expand All @@ -165,22 +165,22 @@
{:name "Gerald J. Sussman"}]}
(add-author {:authors [{:name "Juhana"}]} {:name "Jani"})
=> {:authors [{:name "Juhana"} {:name "Jani"}]})

(facts "alive?" {:exercise 14
:points 1}
(alive? china) => true
(alive? octavia) => false)

(facts "element-lengths" {:exercise 15
:points 1}
(element-lengths ["foo" "bar" "" "quux"]) => [3 3 0 4]
(element-lengths ["x" [:a :b :c] {:y 42}]) => [1 3 1])

(facts "second-elements" {:exercise 16
:points 1}
(second-elements [[1 2] [2 3] [3 4]]) => [2 3 4]
(second-elements [[1 2 3 4] [1] ["a" "s" "d" "f"]]) => [2 nil "s"])

(facts "titles" {:exercise 17
:points 1}
(titles [cities]) => ["The City and the City"]
Expand Down Expand Up @@ -315,7 +315,7 @@
(books->string [cities])
=> "1 book. The City and the City, written by China Miéville (1972 - )."
(books->string [little-schemer, cities, wild-seed])
=> #"3 books. The Little Schemer, written by (Daniel Friedman \(1944 - \), Matthias Felleisen|Matthias Felleisen, Daniel Friedman \(1944 - \)). The City and the City, written by China Miéville \(1972 - \). Wild Seed, written by Octavia E. Butler \(1947 - 2006\).")
=> "3 books. The Little Schemer, written by (Daniel Friedman \(1944 - \), Matthias Felleisen|Matthias Felleisen, Daniel Friedman \(1944 - \)). The City and the City, written by China Miéville \(1972 - \). Wild Seed, written by Octavia E. Butler \(1947 - 2006\).")

(facts "books-by-author" {:exercise 30
:points 1}
Expand All @@ -342,7 +342,7 @@
(has-a-living-author? little-schemer) => true
(has-a-living-author? cities) => true
(has-a-living-author? deus-irae) => false)

(facts "books-by-living-authors" {:exercise 34
:points 1}
(books-by-living-authors books) => (just #{little-schemer cities embassytown})
Expand Down