forked from 4clojure/4clojure
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
135 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,4 @@ | |
(run-jetty (var app) {:join? false :port 8080})) | ||
|
||
(defn -main [& args] | ||
(run)) | ||
(run)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(ns foreclojure.test.users | ||
(:use [foreclojure.users] :reload) | ||
(:use [clojure.test]) | ||
(:use [midje.sweet])) | ||
|
||
|
||
(deftest sorting-by-solved | ||
(def users-by-solved | ||
[{:user "user1" :solved [1] } {:user "user2" :solved [1 2 3 4]} | ||
{:user "user3" :solved [2 2] } {:user "user4" :solved [3]}]) | ||
(def users-sorted-by-solved (users-sort users-by-solved)) | ||
(fact | ||
(:user (first users-sorted-by-solved)) => "user2") | ||
(fact | ||
(:user (last users-sorted-by-solved)) => "user1")) | ||
|
||
(deftest sorting-by-last-login-date | ||
(def date-formatter (java.text.SimpleDateFormat. "MM/dd/yyyy")) | ||
(def date1 (.parse date-formatter "11/01/2001")) | ||
(def date2 (.parse date-formatter "8/1/2010")) | ||
(def users-by-date | ||
[{:user "user1" :last-login date1 } {:user "user2" :last-login date2} | ||
{:user "user3" } {:user "user4" :last-login date1}]) | ||
(sort-by :last-login users-by-date) | ||
(def users-sorted-by-date (users-sort users-by-date)) | ||
(fact | ||
(:user (first users-sorted-by-date)) => "user2") | ||
(fact | ||
(:user (last users-sorted-by-date)) => "user3")) | ||
|