Skip to content

Commit c615178

Browse files
Refactor the tests to accomodate for TestMFlowRate
1 parent e9d06ad commit c615178

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/spec-haskell/pkgs/semantic-money/test/Money/Theory/SemanticMoney_prop.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import Money.Theory.TestMonetaryTypes
1616
-- Monetary Units Laws: settle-idempotency, constant-rtb
1717
--------------------------------------------------------------------------------
1818

19-
mu_settle_idempotency :: ( MonetaryUnit TestMonetaryTypes TestTime TestMValue mu
19+
mu_settle_idempotency :: ( MonetaryUnit TestMonetaryTypes TestTime TestMValue TestMFlowRate mu
2020
, Eq mu
2121
) => mu -> TestTime -> Bool
2222
mu_settle_idempotency a t =
2323
settledAt (settle t a) == t &&
2424
settle t a == settle t (settle t a)
25-
mu_constant_rtb :: ( MonetaryUnit TestMonetaryTypes TestTime TestMValue mu
25+
mu_constant_rtb :: ( MonetaryUnit TestMonetaryTypes TestTime TestMValue TestMFlowRate mu
2626
) => mu -> TestTime -> TestTime -> TestTime -> Bool
2727
mu_constant_rtb a t1 t2 t3 =
2828
rtb (settle t1 a) t3 == rtb a t3 &&
@@ -134,28 +134,28 @@ one2n_pd_tests = describe "1toN proportional distribution 2-primitives" $ do
134134

135135
uu_flow2 (a :: TestUniversalIndex) (b :: TestUniversalIndex) t1 r1 t2 r2 t3 =
136136
flowRate b' == r2 && flowRate a' == -r2 &&
137-
r1 `mt_v_mul_t` (t2 - t1) + r2 `mt_v_mul_t` (t3 - t2) == rtb b' t3 - rtb b t1
137+
r1 `mt_fr_mul_t` (t2 - t1) + r2 `mt_fr_mul_t` (t3 - t2) == rtb b' t3 - rtb b t1
138138
where (a', b') = flow2 r2 t2 (flow2 r1 t1 (a, b))
139139

140140
updp_flow2 (a :: TestUniversalIndex) t1 r1 t2 r2 t3 =
141141
flowRate b'' == r2 && flowRate a'' == -r2 &&
142142
flowRate (b'', b1') == r2 &&
143-
r1 `mt_v_mul_t` (t2 - t1) + r2 `mt_v_mul_t` (t3 - t2) == rtb (b'', b1') t3 - rtb (b', b1') t1
143+
r1 `mt_fr_mul_t` (t2 - t1) + r2 `mt_fr_mul_t` (t3 - t2) == rtb (b'', b1') t3 - rtb (b', b1') t1
144144
where (a', (b', b1')) = pdpUpdateMember2 1 t1 (a, (mempty :: TestPDPoolIndex, def))
145145
(a'', b'') = flow2 r2 t2 (flow2 r1 t1 (a', b'))
146146

147147
uu_shiftFlow2a (a :: TestUniversalIndex) (b :: TestUniversalIndex) t1 r1 t2 r2 t3 =
148148
flowRate b' - flowRate b == r1 + r2 && flowRate a' - flowRate a == -r1 -r2 &&
149149
rtb b' t3 - rtb b t3 == rtb a t3 - rtb a' t3 &&
150150
-- for shift flow semantics: rtb b' t3 - (rtb b t3 - rtb b t1) - rtb b t1 == rtb b' t3 - rtb b t3
151-
r1 `mt_v_mul_t` (t2 - t1) + (r1 + r2) `mt_v_mul_t` (t3 - t2) == rtb b' t3 - rtb b t3
151+
r1 `mt_fr_mul_t` (t2 - t1) + (r1 + r2) `mt_fr_mul_t` (t3 - t2) == rtb b' t3 - rtb b t3
152152
where (a', b') = shiftFlow2a r2 t2 (shiftFlow2a r1 t1 (a, b))
153153

154154
uu_shiftFlow2b (a :: TestUniversalIndex) (b :: TestUniversalIndex) t1 r1 t2 r2 t3 =
155155
flowRate b' - flowRate b == r1 + r2 && flowRate a' - flowRate a == -r1 -r2 &&
156156
rtb b' t3 - rtb b t3 == rtb a t3 - rtb a' t3 &&
157157
-- ditto
158-
r1 `mt_v_mul_t` (t2 - t1) + (r1 + r2) `mt_v_mul_t` (t3 - t2) == rtb b' t3 - rtb b t3
158+
r1 `mt_fr_mul_t` (t2 - t1) + (r1 + r2) `mt_fr_mul_t` (t3 - t2) == rtb b' t3 - rtb b t3
159159
where (a', b') = shiftFlow2b r2 t2 (shiftFlow2b r1 t1 (a, b))
160160

161161
-- NOTE: updp_shiftFlow2a is an invalid property due to right side biansed error term adjustment.
@@ -165,7 +165,7 @@ updp_shiftFlow2b (a :: TestUniversalIndex) t1 r1 t2 r2 t3 =
165165
flowRate (b'', b1') == r1 + r2 &&
166166
rtb (b'', b1') t3 - rtb (b', b1') t3 == rtb a' t3 - rtb a'' t3 &&
167167
-- ditto
168-
r1 `mt_v_mul_t` (t2 - t1) + (r1 + r2) `mt_v_mul_t` (t3 - t2) == rtb (b'', b1') t3 - rtb (b', b1') t3
168+
r1 `mt_fr_mul_t` (t2 - t1) + (r1 + r2) `mt_fr_mul_t` (t3 - t2) == rtb (b'', b1') t3 - rtb (b', b1') t3
169169
where (a', (b', b1')) = pdpUpdateMember2 1 t1 (a, (mempty :: TestPDPoolIndex, def))
170170
(a'', b'') = shiftFlow2b r2 t2 (shiftFlow2b r1 t1 (a', b'))
171171

0 commit comments

Comments
 (0)