diff options
author | William Carroll <wpcarro@gmail.com> | 2020-08-12T10·07+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-08-12T10·07+0100 |
commit | f3ddd89302c9f32d038608882cbe7aa37d9b6577 (patch) | |
tree | d793948f22c94095d1dbb4ea33d46f4f3046c419 /scratch | |
parent | 3d6130c7cfb31d3a5eb5510d3aec55000b7df230 (diff) |
Prefer literal, not computed, examples in the unit tests
TL:DR: - Remove unused imports: Test.QuickCheck and Control.Exception - Remove calls to `reverse` and `Utils.rotate` with their results
Diffstat (limited to 'scratch')
-rw-r--r-- | scratch/brilliant/Spec.hs | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/scratch/brilliant/Spec.hs b/scratch/brilliant/Spec.hs index f2450bdd9a5c..d4b3c9b1961c 100644 --- a/scratch/brilliant/Spec.hs +++ b/scratch/brilliant/Spec.hs @@ -2,8 +2,6 @@ module Spec where -------------------------------------------------------------------------------- import Test.Hspec -import Test.QuickCheck -import Control.Exception (evaluate) import Keyboard (Keyboard(..)) import Transforms (Transform(..)) @@ -42,34 +40,34 @@ main = hspec $ do describe "App.transform" $ do it "flips a keyboard horizontally" $ do App.transform Keyboard.qwerty HorizontalFlip == do - Keyboard [ reverse ['1','2','3','4','5','6','7','8','9','0'] - , reverse ['Q','W','E','R','T','Y','U','I','O','P'] - , reverse ['A','S','D','F','G','H','J','K','L',';'] - , reverse ['Z','X','C','V','B','N','M',',','.','/'] + Keyboard [ ['0','9','8','7','6','5','4','3','2','1'] + , ['P','O','I','U','Y','T','R','E','W','Q'] + , [';','L','K','J','H','G','F','D','S','A'] + , ['/','.',',','M','N','B','V','C','X','Z'] ] it "flips a keyboard vertically" $ do App.transform Keyboard.qwerty VerticalFlip == do - Keyboard $ reverse [ ['1','2','3','4','5','6','7','8','9','0'] - , ['Q','W','E','R','T','Y','U','I','O','P'] - , ['A','S','D','F','G','H','J','K','L',';'] - , ['Z','X','C','V','B','N','M',',','.','/'] - ] + Keyboard $ [ ['Z','X','C','V','B','N','M',',','.','/'] + , ['A','S','D','F','G','H','J','K','L',';'] + , ['Q','W','E','R','T','Y','U','I','O','P'] + , ['1','2','3','4','5','6','7','8','9','0'] + ] - it "shifts a keyboard N times" $ do + it "shifts a keyboard left N times" $ do App.transform Keyboard.qwerty (Shift 2) == do - Keyboard $ [ Utils.rotate 2 ['1','2','3','4','5','6','7','8','9','0'] - , Utils.rotate 2 ['Q','W','E','R','T','Y','U','I','O','P'] - , Utils.rotate 2 ['A','S','D','F','G','H','J','K','L',';'] - , Utils.rotate 2 ['Z','X','C','V','B','N','M',',','.','/'] + Keyboard $ [ ['3','4','5','6','7','8','9','0','1','2'] + , ['E','R','T','Y','U','I','O','P','Q','W'] + , ['D','F','G','H','J','K','L',';','A','S'] + , ['C','V','B','N','M',',','.','/','Z','X'] ] - it "shifts negative amounts" $ do + it "shifts right negative amounts" $ do App.transform Keyboard.qwerty (Shift (-3)) == do - Keyboard $ [ Utils.rotate (-3) ['1','2','3','4','5','6','7','8','9','0'] - , Utils.rotate (-3) ['Q','W','E','R','T','Y','U','I','O','P'] - , Utils.rotate (-3) ['A','S','D','F','G','H','J','K','L',';'] - , Utils.rotate (-3) ['Z','X','C','V','B','N','M',',','.','/'] + Keyboard $ [ ['8','9','0','1','2','3','4','5','6','7'] + , ['I','O','P','Q','W','E','R','T','Y','U'] + , ['K','L',';','A','S','D','F','G','H','J'] + , [',','.','/','Z','X','C','V','B','N','M'] ] describe "Transforms.optimize" $ do |