Skip to content

Commit

Permalink
Merge branch 'develop-style-notab' into develop. Close #205.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanperez-keera committed May 14, 2022
2 parents bd4592a + cf7ba37 commit f3245a6
Show file tree
Hide file tree
Showing 35 changed files with 1,254 additions and 1,250 deletions.
3 changes: 2 additions & 1 deletion yampa-test/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2022-04-27 Ivan Perez <ivan.perez@haskell.sexy>
2022-05-14 Ivan Perez <ivan.perez@haskell.sexy>
* tests/: Replace tabs with spaces (#205).
* yampa-test.cabal: Fix broken link in description (#204).

2022-04-07 Ivan Perez <ivan.perez@haskell.sexy>
Expand Down
60 changes: 30 additions & 30 deletions yampa-test/tests/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Y A M P A *
* *
* Module: Tests *
* Purpose: regression tests. *
* Authors: Antony Courtney and Henrik Nilsson *
* Purpose: regression tests. *
* Authors: Antony Courtney and Henrik Nilsson *
* *
* Copyright (c) Yale University, 2003 *
* *
Expand Down Expand Up @@ -85,23 +85,23 @@ allGood = arr_tr
&& basicsf_tr
&& sscan_tr
&& evsrc_tr
&& coc_tr
&& switch_tr
&& kswitch_tr
&& rswitch_tr
&& pswitch_tr
&& rpswitch_tr
&& wfg_tr
&& accum_tr
&& coc_tr
&& switch_tr
&& kswitch_tr
&& rswitch_tr
&& pswitch_tr
&& rpswitch_tr
&& wfg_tr
&& accum_tr
&& pre_tr
&& delay_tr
&& der_tr
&& loopPre_tr
&& loopIntegral_tr
&& react_tr
&& embed_tr
&& utils_tr
&& task_tr
&& delay_tr
&& der_tr
&& loopPre_tr
&& loopIntegral_tr
&& react_tr
&& embed_tr
&& utils_tr
&& task_tr


all_trs =
Expand All @@ -113,17 +113,17 @@ all_trs =
("loop", loop_trs),
("looplaws", looplaws_trs),
("basicsf", basicsf_trs),
("sscan", sscan_trs),
("sscan", sscan_trs),
("evsrc", evsrc_trs),
("coc", coc_trs),
("switch", switch_trs),
("kswitch", kswitch_trs),
("rswitch", rswitch_trs),
("pswitch", pswitch_trs),
("rpswitch", rpswitch_trs),
("wfg", wfg_trs),
("accum", accum_trs),
("pre", pre_trs),
("wfg", wfg_trs),
("accum", accum_trs),
("pre", pre_trs),
("delay", delay_trs),
("der", der_trs),
("loopPre", loopPre_trs),
Expand All @@ -138,7 +138,7 @@ all_trs =
failedTests =
[ format n i | (n, trs) <- all_trs, (i, tr) <- zip [0..] trs, not tr ]
where
format n i = "Test " ++ n ++ "_t" ++ show i ++ " failed."
format n i = "Test " ++ n ++ "_t" ++ show i ++ " failed."


runRegTests :: IO Bool
Expand Down Expand Up @@ -173,13 +173,13 @@ runSpaceTests = do
rst "accum" 0 accum_st0 accum_st0r
rst "accum" 1 accum_st1 accum_st1r
where
rst n i st str = do
putStrLn ("Running " ++ n ++ "_st" ++ show i ++ " ...")
if st ~= str then
putStrLn "Success!"
else
-- We probably won't get here in case of a (space) failure ...
putStrLn "Failure!"
rst n i st str = do
putStrLn ("Running " ++ n ++ "_st" ++ show i ++ " ...")
if st ~= str then
putStrLn "Success!"
else
-- We probably won't get here in case of a (space) failure ...
putStrLn "Failure!"

-- AC: here because I had trouble running ghci:
-- fixTest :: IO ()
Expand Down
66 changes: 33 additions & 33 deletions yampa-test/tests/TestsAccum.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
******************************************************************************
* Y A M P A *
* *
* Module: TestsAccum *
* Purpose: Test cases for accumulators *
* Authors: Antony Courtney and Henrik Nilsson *
* Module: TestsAccum *
* Purpose: Test cases for accumulators *
* Authors: Antony Courtney and Henrik Nilsson *
* *
* Copyright (c) Yale University, 2003 *
* University of Nottingham, 2005 *
Expand Down Expand Up @@ -34,20 +34,20 @@ import TestsCommon

accum_inp1 = (fromJust (head delta_inp), zip (repeat 1.0) (tail delta_inp))
where
delta_inp =
[Just NoEvent, Nothing, Just (Event (+1.0)), Just NoEvent,
Just (Event (+2.0)), Just NoEvent, Nothing, Nothing,
Just (Event (*3.0)), Just (Event (+5.0)), Nothing, Just NoEvent,
Just (Event (/2.0)), Just NoEvent, Nothing, Nothing]
delta_inp =
[Just NoEvent, Nothing, Just (Event (+1.0)), Just NoEvent,
Just (Event (+2.0)), Just NoEvent, Nothing, Nothing,
Just (Event (*3.0)), Just (Event (+5.0)), Nothing, Just NoEvent,
Just (Event (/2.0)), Just NoEvent, Nothing, Nothing]
++ repeat Nothing

accum_inp2 = (fromJust (head delta_inp), zip (repeat 1.0) (tail delta_inp))
where
delta_inp =
[Just (Event (+1.0)), Just NoEvent, Nothing, Nothing,
Just (Event (+2.0)), Just NoEvent, Nothing, Nothing,
Just (Event (*3.0)), Just (Event (+5.0)), Nothing, Just NoEvent,
Just (Event (/2.0)), Just NoEvent, Nothing, Nothing]
delta_inp =
[Just (Event (+1.0)), Just NoEvent, Nothing, Nothing,
Just (Event (+2.0)), Just NoEvent, Nothing, Nothing,
Just (Event (*3.0)), Just (Event (+5.0)), Nothing, Just NoEvent,
Just (Event (/2.0)), Just NoEvent, Nothing, Nothing]
++ repeat Nothing

accum_inp3 = deltaEncode 1.0 $
Expand Down Expand Up @@ -114,9 +114,9 @@ accum_accFiltFun1 a d =
let a' = a + floor d
in
if even a' then
(a', Just (a' > 10, a'))
(a', Just (a' > 10, a'))
else
(a', Nothing)
(a', Nothing)

accum_t4 :: [Event (Bool,Int)]
accum_t4 = take 16 $ embed (accumFilter accum_accFiltFun1 0) accum_inp3
Expand All @@ -133,9 +133,9 @@ accum_accFiltFun2 a d =
let a' = a + floor d
in
if odd a' then
(a', Just (a' > 10, a'))
(a', Just (a' > 10, a'))
else
(a', Nothing)
(a', Nothing)

accum_t5 :: [Event (Bool,Int)]
accum_t5 = take 16 $ embed (accumFilter accum_accFiltFun2 0) accum_inp4
Expand All @@ -153,23 +153,23 @@ accumFilter2 :: (c -> a -> (c, Maybe b)) -> c -> SF (Event a) (Event b)
accumFilter2 f c_init =
switch (never &&& attach c_init) afAux
where
afAux (c, a) =
afAux (c, a) =
case f c a of
(c', Nothing) -> switch (never &&& (notYet>>>attach c')) afAux
(c', Just b) -> switch (now b &&& (notYet>>>attach c')) afAux
(c', Nothing) -> switch (never &&& (notYet>>>attach c')) afAux
(c', Just b) -> switch (now b &&& (notYet>>>attach c')) afAux

attach :: b -> SF (Event a) (Event (b, a))
attach :: b -> SF (Event a) (Event (b, a))
attach c = arr (fmap (\a -> (c, a)))

accum_t6 :: [Event (Bool,Int)]
accum_t6 = take 16 $ embed (accumFilter2 accum_accFiltFun1 0) accum_inp3

accum_t6r = accum_t4 -- Should agree!
accum_t6r = accum_t4 -- Should agree!

accum_t7 :: [Event (Bool,Int)]
accum_t7 = take 16 $ embed (accumFilter2 accum_accFiltFun2 0) accum_inp4

accum_t7r = accum_t5 -- Should agree!
accum_t7r = accum_t5 -- Should agree!


accum_t8 :: [Event Int]
Expand Down Expand Up @@ -210,7 +210,7 @@ accum_t10 = take 40 $ embed (repeatedly 1.0 1
accum_inp5

accum_t10r :: [Int]
accum_t10r = accum_t9 -- Should agree!
accum_t10r = accum_t9 -- Should agree!


accum_t11 :: [Int]
Expand All @@ -232,17 +232,17 @@ accum_t12 = take 40 $ embed (repeatedly 1.0 1
accum_inp5

accum_t12r :: [Int]
accum_t12r = accum_t11 -- Should agree!
accum_t12r = accum_t11 -- Should agree!


accum_accFiltFun3 :: Int -> Int -> (Int, Maybe Int)
accum_accFiltFun3 s a =
let s' = s + a
in
if odd s' then
(s', Just s')
(s', Just s')
else
(s', Nothing)
(s', Nothing)


accum_t13 :: [Event Int]
Expand Down Expand Up @@ -286,7 +286,7 @@ accum_t15 = take 40 $ embed (repeatedly 1.0 1
accum_inp5

accum_t15r :: [Int]
accum_t15r = accum_t14 -- Should agree!
accum_t15r = accum_t14 -- Should agree!


accum_t16 :: [Int]
Expand All @@ -310,7 +310,7 @@ accum_t17 = take 40 $ embed (repeatedly 1.0 1
accum_inp5

accum_t17r :: [Int]
accum_t17r = accum_t16 -- Should agree!
accum_t17r = accum_t16 -- Should agree!



Expand Down Expand Up @@ -350,12 +350,12 @@ accum_st0r = 249999.0
accum_st1 :: Double
accum_st1 = testSFSpaceLeak 1000000
(arr dup
>>> first (repeatedly 1.0 1.0)
>>> arr (\(e,a) -> tag e a)
>>> first (repeatedly 1.0 1.0)
>>> arr (\(e,a) -> tag e a)
>>> accumFilter accumFun 0.0
>>> hold (-99.99))
where
accumFun c a | even (floor a) = (c+a, Just (c+a))
| otherwise = (c, Nothing)
accumFun c a | even (floor a) = (c+a, Just (c+a))
| otherwise = (c, Nothing)

accum_st1r = 6.249975e10
4 changes: 2 additions & 2 deletions yampa-test/tests/TestsArr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Y A M P A *
* *
* Module: TestsArr *
* Purpose: Test cases for arr *
* Authors: Antony Courtney and Henrik Nilsson *
* Purpose: Test cases for arr *
* Authors: Antony Courtney and Henrik Nilsson *
* *
* Copyright (c) Yale University, 2003 *
* *
Expand Down
6 changes: 3 additions & 3 deletions yampa-test/tests/TestsBasicSF.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
******************************************************************************
* Y A M P A *
* *
* Module: TestsBasicSF *
* Purpose: Test cases for basic signal functions *
* Authors: Antony Courtney and Henrik Nilsson *
* Module: TestsBasicSF *
* Purpose: Test cases for basic signal functions *
* Authors: Antony Courtney and Henrik Nilsson *
* *
* Copyright (c) Yale University, 2003 *
* *
Expand Down
6 changes: 3 additions & 3 deletions yampa-test/tests/TestsCOC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
******************************************************************************
* Y A M P A *
* *
* Module: TestsCOC *
* Purpose: Test cases for collection-oriented combinators *
* Authors: Antony Courtney and Henrik Nilsson *
* Module: TestsCOC *
* Purpose: Test cases for collection-oriented combinators *
* Authors: Antony Courtney and Henrik Nilsson *
* *
* Copyright (c) Yale University, 2003 *
* *
Expand Down
Loading

0 comments on commit f3245a6

Please sign in to comment.