|
| 1 | +module OrthogonalSpec where |
| 2 | + |
| 3 | +import Orthogonal (isOrthogonal) |
| 4 | +import Test.HUnit |
| 5 | +import Test.Hspec |
| 6 | + |
| 7 | +runTest :: ([Int], [Int], Bool) -> Expectation |
| 8 | +runTest (xs, ys, expected) = |
| 9 | + assertEqual (unwords [show xs, show ys]) expected $ |
| 10 | + isOrthogonal xs ys |
| 11 | + |
| 12 | +spec :: Spec |
| 13 | +spec = do |
| 14 | + describe "Fixed Tests" $ do |
| 15 | + it "Works for some example tests" $ do |
| 16 | + mapM_ |
| 17 | + runTest |
| 18 | + [ ([1, 2], [2, 1], False), |
| 19 | + ([1, -2], [2, 1], True), |
| 20 | + ([7, 8], [7, -6], False), |
| 21 | + ([-13, -26], [-8, 4], True), |
| 22 | + ([1, 2, 3], [0, -3, 2], True), |
| 23 | + ([3, 4, 5], [6, 7, -8], False), |
| 24 | + ([3, -4, -5], [-4, -3, 0], True), |
| 25 | + ([1, -2, 3, -4], [-4, 3, 2, -1], True), |
| 26 | + ([2, 4, 5, 6, 7], [-14, -12, 0, 8, 4], True), |
| 27 | + ([5, 10, 1, 20, 2], [-2, -20, -1, 10, 5], False) |
| 28 | + ] |
0 commit comments