mirror of
https://github.com/sbrow/risk-multilang.git
synced 2025-12-30 00:47:39 -05:00
feat: Added Haskell and Go.
This commit is contained in:
29
haskell/test/Spec.hs
Normal file
29
haskell/test/Spec.hs
Normal file
@@ -0,0 +1,29 @@
|
||||
import Test.Tasty
|
||||
import Test.Tasty.HUnit
|
||||
import Test.Tasty.QuickCheck
|
||||
import qualified Test.Tasty.SmallCheck as SC
|
||||
|
||||
arith :: Integer -> Integer -> Property
|
||||
arith x y = (x > 0) && (y > 0) ==> (x+y)^2 > x^2 + y^2
|
||||
|
||||
negation :: Integer -> Bool
|
||||
negation x = abs (x^2) >= x
|
||||
|
||||
suite :: TestTree
|
||||
suite = testGroup "Test Suite" [
|
||||
testGroup "Units"
|
||||
[ testCase "Equality" $ True @=? True
|
||||
, testCase "Assertion" $ assert $ (length [1,2,3]) == 3
|
||||
],
|
||||
|
||||
testGroup "QuickCheck tests"
|
||||
[ testProperty "Quickcheck test" arith
|
||||
],
|
||||
|
||||
testGroup "SmallCheck tests"
|
||||
[ SC.testProperty "Negation" negation
|
||||
]
|
||||
]
|
||||
|
||||
main :: IO ()
|
||||
main = defaultMain suite
|
||||
Reference in New Issue
Block a user