Skip to content

Commit

Permalink
Merge pull request #210 from thelmuth/checksum-more-test-cases
Browse files Browse the repository at this point in the history
Checksum more test cases
lein release minor
  • Loading branch information
lspector committed Jul 23, 2016
2 parents 3bd68ef + 7a8a85c commit 8d11809
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/clojush/problems/software/checksum.clj
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@
;; inputs is either a list or a function that, when called, will create a
;; random element of the set.
(def checksum-data-domains
[[(list "", "A", "\t", "\n", "B\n", "\n\n",
[[(list "", "\t", "\n", "B\n", "\n\n",
(apply str (repeat 50 \newline))
(apply str (repeat 50 \space))
(apply str (repeat 50 \s))
(apply str (take 50 (cycle (list \C \D \newline))))
(apply str (take 50 (cycle (list \x \newline \y \space))))
(apply str (take 50 (cycle (list \space \newline))))) 12 0] ;; "Special" inputs covering some base cases
[(fn [] (checksum-input (inc (lrand-int 50)))) 88 1000]
(apply str (take 50 (cycle (list \space \newline))))) 11 0] ;; "Special" inputs covering some base cases
[(map str (map char (range 32 127))) 95 0] ; All visible characters once
[(fn [] (checksum-input 2)) 55 500] ; Random length-2 inputs
[(fn [] (checksum-input 3)) 50 500] ; Random length-3 inputs
[(fn [] (checksum-input (+ 2 (lrand-int 49)))) 89 1000] ; Random >= 2 length inputs
])

;;Can make checksum test data like this:
Expand Down
13 changes: 9 additions & 4 deletions src/clojush/problems/software/vector_average.clj
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@
;; inputs is either a list or a function that, when called, will create a
;; random element of the set.
(def vector-average-data-domains
[[(list [0.0] [100.0] [-100.0]) 3 0] ;; Length 1 vectors
[[(list [0.0] [100.0] [-100.0] [1000.0] [-1000.0]) 5 0] ;; Length-1 vectors
[(fn [] (vector-average-input 1)) 45 500] ;; Random Length-1 vectors
[(list [2.0 129.0]
[0.12345 -4.678]
[999.99 74.113]) 3 0] ;; Length 2 vectors
[(fn [] (vector-average-input 50)) 4 50] ;; Length 50 vectors
[(fn [] (vector-average-input (inc (lrand-int 50)))) 90 950] ;; Random length, random floats
[999.99 74.113]
[987.654321 995.0003]
[-788.788 -812.19]) 5 0] ;; Length-2 vectors
[(fn [] (vector-average-input 2)) 45 500] ;; Random Length-2 vectors
[(fn [] (vector-average-input (+ 3 (lrand-int 3)))) 50 500] ;; Random Length-3, -4, and -5 vectors
[(fn [] (vector-average-input 50)) 5 50] ;; Random Length-50 vectors
[(fn [] (vector-average-input (inc (lrand-int 50)))) 95 1000] ;; Random length, random floats
])

;;Can make Vector Average test data like this:
Expand Down

0 comments on commit 8d11809

Please sign in to comment.