Meikel  Brandmeyer avatar Meikel Brandmeyer committed bdc9632

Fix example

Comments (0)

Files changed (1)

src/main/clojure/clojurecheck/core.clj

 
     (defn angular-diff
       [a b]
-      (-> (- a b) (mod 180) Math/abs))
+      (-> (- a b) Math/abs (mod 180)))
 
     (deftest angular-diff-standard-test
       (are [x y] (= x y)
 
     (deftest angular-diff-property
       (cc/property „angular-diff is smallest angel between a and b“
-        [diff (cc/float :lower -180.0 :upper 180.0)
-         a    (cc/float :lower 0.0 :upper 360.0)
-         n    (cc/int)]
+        [a    (cc/int)
+         n    (cc/int)
+         diff (cc/int :lower -180 :upper 180)]
         (let [b (+ a (* 360 n) diff)]
           (is (= (angular-diff a b) (Math/abs diff))))))
 
   And a result:
-    user=> (run-tests)
+    my.package=> (run-tests)
     Testing my.package
 
-    FAIL in (angular-diff-property) (core.clj:288)
-    falsified angular-diff is smallest angel between a and b in 3 attempts
+    FAIL in (angular-diff-property) (core.clj:305)
+    falsified 'angular-diff is smallest angel between a and b' in 5 attempts
     inputs where:
-      diff = 1.3374370509881066
-      a = 0.5071098240831757
-      n = -1
+      a = -2
+      n = 1
+      diff = -3
     failed assertions where:
       expected: (= (angular-diff a b) (Math/abs diff))
-        actual: (not (= 178.66256294901189 1.3374370509881066))
+        actual: (not (= 177 3))
 
     Ran 2 tests containing 7 assertions.
     1 failures, 0 errors.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.