implementing tests
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
(ns NoteHub.test.all
|
||||
(:use [NoteHub.storage] [clojure.test]))
|
||||
|
||||
(def date [2012 06 03])
|
||||
(def test-title "Some title.")
|
||||
(def test-note "This is a test note.")
|
||||
|
||||
(testing "Storage"
|
||||
(testing "of correct note creation"
|
||||
(is (= (do
|
||||
(set-note date test-title test-note)
|
||||
(get-note date test-title))
|
||||
test-note)))
|
||||
(testing "of the note access"
|
||||
(is (not= (get-note date test-title) "any text")))
|
||||
(testing "of note existence"
|
||||
(is (note-exists? date test-title))
|
||||
(is (not (do
|
||||
(delete-note date test-title)
|
||||
(note-exists? date test-title))))
|
||||
(is (not (note-exists? [2013 06 03] test-title)))
|
||||
(is (not (note-exists? date "some title")))))
|
||||
|
||||
|
||||
|
||||
; to test
|
||||
;
|
||||
; crossover.lib
|
||||
; storage
|
||||
; pages
|
||||
; noir.util.test
|
||||
@@ -0,0 +1,16 @@
|
||||
(ns NoteHub.test.crossover.lib
|
||||
(:require [NoteHub.crossover.lib :as lib])
|
||||
(:use [clojure.test]))
|
||||
|
||||
(with-test
|
||||
(defn lib-hash [s]
|
||||
(lib/hash #(.codePointAt % 0) s))
|
||||
(testing "Crossover Lib:"
|
||||
(testing "Self-made hash function"
|
||||
(testing "for correct hashes"
|
||||
(is (= 0 (lib-hash "")))
|
||||
(is (= 6178 (lib-hash "test тест")))
|
||||
(is (= 6178 (lib-hash (str "test\n \rтест"))))
|
||||
(is (= 274 (lib-hash "Hello world!"))))
|
||||
(testing "for a wrong hash"
|
||||
(is (not= 6178 (lib-hash "wrong hash")))))))
|
||||
@@ -0,0 +1,22 @@
|
||||
(ns NoteHub.test.all
|
||||
(:use [NoteHub.storage] [clojure.test]))
|
||||
|
||||
(def date [2012 06 03])
|
||||
(def test-title "Some title.")
|
||||
(def test-note "This is a test note.")
|
||||
|
||||
(testing "Storage"
|
||||
(testing "of correct note creation"
|
||||
(is (= (do
|
||||
(set-note date test-title test-note)
|
||||
(get-note date test-title))
|
||||
test-note)))
|
||||
(testing "of the note access"
|
||||
(is (not= (get-note date test-title) "any text")))
|
||||
(testing "of note existence"
|
||||
(is (note-exists? date test-title))
|
||||
(is (not (do
|
||||
(delete-note date test-title)
|
||||
(note-exists? date test-title))))
|
||||
(is (not (note-exists? [2013 06 03] test-title)))
|
||||
(is (not (note-exists? date "some title")))))
|
||||
Reference in New Issue
Block a user