move test/ to tests/
authorJulien Moutinho <julm+hjugement@autogeree.net>
Sun, 12 May 2019 00:03:10 +0000 (00:03 +0000)
committerJulien Moutinho <julm+hjugement@autogeree.net>
Sun, 12 May 2019 00:03:10 +0000 (00:03 +0000)
19 files changed:
hjugement/hjugement.cabal
hjugement/tests/Bug.hs [new file with mode: 0644]
hjugement/tests/HLint.hs [moved from hjugement/test/HLint.hs with 100% similarity]
hjugement/tests/HUnit.hs [moved from hjugement/test/HUnit.hs with 100% similarity]
hjugement/tests/HUnit/HLint.hs [moved from hjugement/test/HUnit/HLint.hs with 100% similarity]
hjugement/tests/HUnit/Merit.hs [moved from hjugement/test/HUnit/Merit.hs with 100% similarity]
hjugement/tests/HUnit/Rank.hs [moved from hjugement/test/HUnit/Rank.hs with 100% similarity]
hjugement/tests/HUnit/Section.hs [moved from hjugement/test/HUnit/Section.hs with 100% similarity]
hjugement/tests/HUnit/Utils.hs [moved from hjugement/test/HUnit/Utils.hs with 100% similarity]
hjugement/tests/HUnit/Value.hs [moved from hjugement/test/HUnit/Value.hs with 100% similarity]
hjugement/tests/Main.hs [moved from hjugement/test/Main.hs with 100% similarity]
hjugement/tests/QuickCheck.hs [moved from hjugement/test/QuickCheck.hs with 100% similarity]
hjugement/tests/QuickCheck/Gauge.hs [moved from hjugement/test/QuickCheck/Gauge.hs with 100% similarity]
hjugement/tests/QuickCheck/HLint.hs [moved from hjugement/test/QuickCheck/HLint.hs with 100% similarity]
hjugement/tests/QuickCheck/Merit.hs [moved from hjugement/test/QuickCheck/Merit.hs with 100% similarity]
hjugement/tests/QuickCheck/Rank.hs [moved from hjugement/test/QuickCheck/Rank.hs with 100% similarity]
hjugement/tests/QuickCheck/Utils.hs [moved from hjugement/test/QuickCheck/Utils.hs with 100% similarity]
hjugement/tests/QuickCheck/Value.hs [moved from hjugement/test/QuickCheck/Value.hs with 100% similarity]
hjugement/tests/Types.hs [moved from hjugement/test/Types.hs with 100% similarity]

index eaee51efecba57973c4d7dc082d4131dacfa205c..b7abe91d201988f6501e5795bbe3bb14b1435d20 100644 (file)
@@ -74,7 +74,7 @@ Library
 
 Test-Suite hjugement-test
   type: exitcode-stdio-1.0
-  hs-source-dirs: test
+  hs-source-dirs: tests
   main-is: Main.hs
   other-modules:
     HUnit
diff --git a/hjugement/tests/Bug.hs b/hjugement/tests/Bug.hs
new file mode 100644 (file)
index 0000000..9d104f4
--- /dev/null
@@ -0,0 +1,33 @@
+{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
+module Bug where
+
+import Hjugement
+
+-- | Decompress a 'Value'.
+expandValue :: Value a -> [a]
+expandValue (Value []) = []
+expandValue (Value ((x,c):xs)) = replicate c x ++ expandValue (Value xs)
+
+data Grade = Null | Pass | Good
+ deriving (Eq, Ord, Show, Bounded, Enum)
+
+(meritX,meritY) = (Merit (fromList [(Null,1),(Pass,71-50-3),(Good,15-3)])
+                  ,Merit (fromList [(Null,7),(Pass,68-50-3),(Good,12-3)]))
+
+totX = let Merit x = meritX in sum x
+totY = let Merit x = meritY in sum x
+
+(mgX,mgY) = (majorityGauge meritX,majorityGauge meritY)
+(mvX,mvY) = (majorityValue meritX,majorityValue meritY)
+mgC = compare mgX mgY
+mvC = compare mvX mvY
+
+allX = expandValue (majorityValue meritX)
+allY = expandValue (majorityValue meritY)
+
+(simpX, simpY) = simpl allX allY
+
+simpl [] ys = ([], ys)
+simpl xs [] = (xs, [])
+simpl (x:xs) (y:ys) | x == y = simpl xs ys
+                    | otherwise = (xs, ys)