diff options
author | Eduardo Julian | 2022-12-22 15:51:13 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-12-22 15:51:13 -0400 |
commit | 4f4a96635abb04239102e4b72dc2a9c6f678dcd2 (patch) | |
tree | 0c42c6c802b6f8f6742b61c4bced1906edfeea81 /stdlib/source/test/lux/world | |
parent | 240a4465157bb903dd2a3ee4cdc28aadf09f8dcb (diff) |
Now showing stack-traces for runtime exceptions in Ruby.
Diffstat (limited to '')
5 files changed, 64 insertions, 19 deletions
diff --git a/stdlib/source/test/lux/world.lux b/stdlib/source/test/lux/world.lux index e4f9f5cec..2832e94be 100644 --- a/stdlib/source/test/lux/world.lux +++ b/stdlib/source/test/lux/world.lux @@ -20,7 +20,8 @@ ["[1]/[0]" market ["[1]/[0]" price] ["[1]/[0]" analysis - ["[1]/[0]" accumulation_distribution]]]] + ["[1]/[0]" accumulation_distribution] + ["[1]/[0]" pivot_point]]]] ["[1][0]" net] ["[1][0]" time] ["[1][0]" locale] @@ -41,6 +42,7 @@ /finance/trade/session.test /finance/market/price.test /finance/market/analysis/accumulation_distribution.test + /finance/market/analysis/pivot_point.test /net.test /time.test diff --git a/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux b/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux index 74b502140..15b8fa6a6 100644 --- a/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux +++ b/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux @@ -22,7 +22,7 @@ Test (<| (_.covering /._) (do [! random.monad] - [session (sessionT.random currency.usd)]) + [session (sessionT.random currency.usd 1000,00)]) (all _.and (_.coverage [/.oscillation] (let [it (/.oscillation session)] diff --git a/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux b/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux new file mode 100644 index 000000000..bb7cd12b3 --- /dev/null +++ b/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux @@ -0,0 +1,40 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)]] + [math + ["[0]" random (.only Random)]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + [//// + ["[0]" money (.only) + ["[0]" currency]] + [trade + ["[0]" session (.only) + ["[1]T" \\test]]]]]]) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [session (sessionT.random currency.usd 1000,00)]) + (all _.and + (_.coverage [/.typical_price] + (let [it (/.typical_price session)] + (and (money.<= (the session.#high session) + it) + (money.>= (the session.#low session) + it)))) + (_.coverage [/.Central_Pivot_Range /.central_pivot_range + /.#pivot_point /.#top_central /.#bottom_central] + (let [it (/.central_pivot_range session)] + (and (money.= (/.typical_price session) + (the /.#pivot_point it)) + (money.< (the /.#top_central it) + (the /.#pivot_point it)) + (money.> (the /.#bottom_central it) + (the /.#pivot_point it))))) + ))) diff --git a/stdlib/source/test/lux/world/finance/money.lux b/stdlib/source/test/lux/world/finance/money.lux index 073f19f34..dd5108cac 100644 --- a/stdlib/source/test/lux/world/finance/money.lux +++ b/stdlib/source/test/lux/world/finance/money.lux @@ -14,7 +14,7 @@ ["[0]" text (.only) ["%" \\format]]] [math - ["[0]" random (.only Random) (.use "[1]#[0]" functor)] + ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat]]] [test @@ -25,12 +25,15 @@ ["[0]" / ["[1][0]" currency]]) -(def .public (random $) +(def .public (random $ max_sub_units) (All (_ $) - (-> (Currency $) + (-> (Currency $) Nat (Random (/.Money $)))) - (random#each (/.money $) - random.nat)) + (when max_sub_units + 0 (random#in (/.money $ max_sub_units)) + _ (random#each (|>> (n.% max_sub_units) + (/.money $)) + random.nat))) (def .public test Test @@ -43,9 +46,9 @@ (_.for [/.Money]) (all _.and (_.for [/.equivalence /.=] - (equivalenceS.spec /.equivalence (..random currency.usd))) + (equivalenceS.spec /.equivalence (..random currency.usd 1000,00))) (_.for [/.order /.<] - (orderT.spec /.order (..random currency.usd))) + (orderT.spec /.order (..random currency.usd 1000,00))) (_.coverage [/.money /.currency /.amount] (let [it (/.money currency.usd expected_amount)] @@ -98,7 +101,7 @@ (/.of_sub_units currency.usd (/.sub_units expected)))] (/.= expected actual))) (do ! - [it (..random currency.usd)] + [it (..random currency.usd 1000,00)] (_.coverage [/.format] (and (text.starts_with? (%.nat (/.amount it)) (text.replaced_once "." "" (/.format it))) diff --git a/stdlib/source/test/lux/world/finance/trade/session.lux b/stdlib/source/test/lux/world/finance/trade/session.lux index 7519d63e3..70dde1b44 100644 --- a/stdlib/source/test/lux/world/finance/trade/session.lux +++ b/stdlib/source/test/lux/world/finance/trade/session.lux @@ -24,15 +24,15 @@ [/// ["[0]T" money]]) -(def .public (random $) +(def .public (random $ max_sub_units) (All (_ $) - (-> (Currency $) + (-> (Currency $) Nat (Random (/.Session $)))) (do random.monad - [p0 (moneyT.random $) - p1 (moneyT.random $) - p2 (moneyT.random $) - p3 (moneyT.random $) + [p0 (moneyT.random $ max_sub_units) + p1 (moneyT.random $ max_sub_units) + p2 (moneyT.random $ max_sub_units) + p3 (moneyT.random $ max_sub_units) bullish? random.bit volume random.nat] (when (list.sorted money.< (list p0 p1 p2 p3)) @@ -54,13 +54,13 @@ Test (<| (_.covering /._) (do [! random.monad] - [before (..random currency.usd) - after (..random currency.usd)]) + [before (..random currency.usd 1000,00) + after (..random currency.usd 1000,00)]) (_.for [/.Session /.Volume /.#open /.#high /.#low /.#close /.#volume]) (all _.and (_.for [/.equivalence] - (equivalenceS.spec /.equivalence (..random currency.usd))) + (equivalenceS.spec /.equivalence (..random currency.usd 1000,00))) (_.coverage [/.composite] (let [both (/.composite before after)] |