on master help sign in
Write a regression test for filtered stream equality
5a2daa3Bryan O'Sullivan
tests/Properties.hs+8−1
@@ -208,6 +208,11 @@ prop_T_elemIndices c = L.elemIndices c`eqP` T.elemIndices c
208prop_T_count c = (L.length . L.elemIndices c) `eqP` T.count c
208prop_T_count c = (L.length . L.elemIndices c) `eqP` T.count c
209prop_T_zipWith c s = L.zipWith c s `eqP` (T.unpack . T.zipWith c (T.pack s))
209prop_T_zipWith c s = L.zipWith c s `eqP` (T.unpack . T.zipWith c (T.pack s))
210
210
211+-- Regression tests.
212+prop_S_filter_eq s = S.filter p t == S.streamList (filter p s)
213+ where p = (/= S.last t)
214+ t = S.streamList s
215+
211-- Make a stream appear shorter than it really is, to ensure that
216-- Make a stream appear shorter than it really is, to ensure that
212-- functions that consume inaccurately sized streams behave
217-- functions that consume inaccurately sized streams behave
213-- themselves.
218-- themselves.
@@ -335,5 +340,7 @@ tests = [
335 ("prop_T_elemIndex", mytest prop_T_elemIndex),
340 ("prop_T_elemIndex", mytest prop_T_elemIndex),
336 ("prop_T_elemIndices", mytest prop_T_elemIndices),
341 ("prop_T_elemIndices", mytest prop_T_elemIndices),
337 ("prop_T_count", mytest prop_T_count),
342 ("prop_T_count", mytest prop_T_count),
338− ("prop_T_zipWith", mytest prop_T_zipWith)
343+ ("prop_T_zipWith", mytest prop_T_zipWith),
344+
345+ ("prop_S_filter_eq", mytest prop_S_filter_eq)
339 ]
346 ]