Skip to content

Commit 0a0de7f

Browse files
committed
Don't cover querying or supplying credits to non-union tables in QLS
We cover the trivial case of querying or supplying credits to tables that are not derived from a union operation in the unit tests, so we do not need to spend coverage space in the QLS tests on the trivial cases. So only gnerate RemainingUnionDebt, SupplyUnionCredits for tables that are derived from union operations.
1 parent 98fad1f commit 0a0de7f

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

test/Test/Database/LSMTree/StateMachine.hs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,42 +1969,36 @@ arbitraryActionWithVars _ label ctx (ModelState st _stats) =
19691969
, let genErrors = pure Nothing -- TODO: generate errors
19701970
]
19711971
++ [ (2, fmap Some $ (Action <$> genErrors <*>) $
1972-
RemainingUnionDebt <$> genUnionTableVar)
1973-
| let genErrors = pure Nothing -- TODO: generate errors
1972+
RemainingUnionDebt <$> genUnionDescendantTableVar)
1973+
-- Tables not derived from unions are covered in UnitTests.
1974+
| not (null unionDescendantTableVars)
1975+
, let genErrors = pure Nothing -- TODO: generate errors
19741976
-- TODO: this is currently only enabled for the reference
19751977
-- implementation. Enable this unconditionally once table union is
19761978
-- implemented
19771979
, isJust (eqT @h @ModelIO.Table)
19781980
]
19791981
++ [ (8, fmap Some $ (Action <$> genErrors <*>) $
1980-
SupplyUnionCredits <$> genUnionTableVar <*> genUnionCredits)
1981-
| let genErrors = pure Nothing -- TODO: generate errors
1982+
SupplyUnionCredits <$> genUnionDescendantTableVar <*> genUnionCredits)
1983+
-- Tables not derived from unions are covered in UnitTests.
1984+
| not (null unionDescendantTableVars)
1985+
, let genErrors = pure Nothing -- TODO: generate errors
19821986
-- TODO: this is currently only enabled for the reference
19831987
-- implementation. Enable this unconditionally once table union is
19841988
-- implemented
19851989
, isJust (eqT @h @ModelIO.Table)
19861990
]
19871991
++ [ (2, fmap Some $ (Action <$> genErrors <*>) $
1988-
SupplyPortionOfDebt <$> genUnionTableVar <*> genPortion)
1989-
| let genErrors = pure Nothing -- TODO: generate errors
1992+
SupplyPortionOfDebt <$> genUnionDescendantTableVar <*> genPortion)
1993+
-- Tables not derived from unions are covered in UnitTests.
1994+
| not (null unionDescendantTableVars)
1995+
, let genErrors = pure Nothing -- TODO: generate errors
19901996
-- TODO: this is currently only enabled for the reference
19911997
-- implementation. Enable this unconditionally once table union is
19921998
-- implemented
19931999
, isJust (eqT @h @ModelIO.Table)
19942000
]
19952001
where
1996-
-- For querying the union debt or supplying union credits, the
1997-
-- interesting cases to test for are when tables are union tables. For
1998-
-- non-union tables, these operations should just be no-ops, so we
1999-
-- generate them only rarely.
2000-
--
2001-
-- TODO: tweak distribution once table unions are implemented
2002-
-- TODO: replace union actions on non-union tables with unit tests?
2003-
genUnionTableVar = QC.frequency [
2004-
(9 * length unionDescendantTableVars, genUnionDescendantTableVar)
2005-
, (1 * length notUnionDescendantTableVars, genNotUnionDescendantTableVar)
2006-
]
2007-
20082002
-- TODO: tweak distribution once table unions are implemented
20092003
genUnionCredits = QC.frequency [
20102004
-- The typical, interesting case is to supply a positive number of

0 commit comments

Comments
 (0)