diff --git a/yampa-test/tests/Test/FRP/Yampa/Basic.hs b/yampa-test/tests/Test/FRP/Yampa/Basic.hs index f2d63412..3217644f 100644 --- a/yampa-test/tests/Test/FRP/Yampa/Basic.hs +++ b/yampa-test/tests/Test/FRP/Yampa/Basic.hs @@ -21,14 +21,16 @@ import TestsCommon tests :: TestTree tests = testGroup "Regression tests for FRP.Yampa.Basic" [ testProperty "identity (fixed)" (property $ basicsf_t0 ~= basicsf_t0r) - , testProperty "constant (fixed)" (property $ basicsf_t1 ~= basicsf_t1r) - , testProperty "initially (fixed)" (property $ basicsf_t4 ~= basicsf_t4r) , testProperty "identity (qc)" prop_basic_identity_1 , testProperty "identity (qc)" prop_basic_identity_2 + , testProperty "constant (fixed)" (property $ basicsf_t1 ~= basicsf_t1r) , testProperty "constant (qc)" prop_basic_constant + , testProperty "initially (fixed)" (property $ basicsf_t4 ~= basicsf_t4r) , testProperty "initially (qc)" prop_basic_initially ] +-- * Basic signal functions + basicsf_t0 :: [Double] basicsf_t0 = testSF1 identity basicsf_t0r = @@ -37,22 +39,6 @@ basicsf_t0r = , 20.0, 21.0, 22.0, 23.0, 24.0 ] -basicsf_t1 :: [Double] -basicsf_t1 = testSF1 (constant 42.0) -basicsf_t1r = - [ 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0 - , 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0 - , 42.0, 42.0, 42.0, 42.0, 42.0 - ] - -basicsf_t4 :: [Double] -basicsf_t4 = testSF1 (initially 42.0) -basicsf_t4r = - [ 42.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 - , 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0 - , 20.0, 21.0, 22.0, 23.0, 24.0 - ] - -- Yampa's Basic SF builders prop_basic_identity_1 = forAll myStream $ evalT $ Always $ prop (sf, pred) @@ -66,6 +52,14 @@ prop_basic_identity_2 = where myStream :: Gen (SignalSampleStream Float) myStream = uniDistStream +basicsf_t1 :: [Double] +basicsf_t1 = testSF1 (constant 42.0) +basicsf_t1r = + [ 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0 + , 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0, 42.0 + , 42.0, 42.0, 42.0, 42.0, 42.0 + ] + prop_basic_constant = forAll myStream $ evalT $ Always $ prop (sf, pred) where myStream :: Gen (SignalSampleStream Float) @@ -74,13 +68,7 @@ prop_basic_constant = sf = constant 42.0 pred = const (== 42.0) -prop_basic_initially = - forAll myStream $ evalT $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream - - sf = initially 42.0 - pred = const (== 42.0) +-- * Initialization prop_insert = forAll initialValueG $ \initialValue -> @@ -101,6 +89,24 @@ prop_insert = finalValueG :: Gen Float finalValueG = arbitrary +basicsf_t4 :: [Double] +basicsf_t4 = testSF1 (initially 42.0) +basicsf_t4r = + [ 42.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 + , 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0 + , 20.0, 21.0, 22.0, 23.0, 24.0 + ] + +prop_basic_initially = + forAll myStream $ evalT $ prop (sf, pred) + where myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream + + sf = initially 42.0 + pred = const (== 42.0) + +-- * Auxiliary + -- prop :: SF a b -> (a -> b -> prop (a,b) = SP ((identity &&& a) >>^ uncurry b)