Skip to content

Commit

Permalink
Improving test coverage [part 10]
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Feb 18, 2025
1 parent 417a10f commit bd5ae04
Show file tree
Hide file tree
Showing 40 changed files with 1,228 additions and 832 deletions.
4 changes: 4 additions & 0 deletions documentation/bookmark/network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Reference

0. [Sniffnet: Comfortably monitor your Internet traffic](https://github.com/GyulyVGC/sniffnet)

14 changes: 7 additions & 7 deletions stdlib/source/injection/lux/data/binary.lux
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
(for_any (_ it)
(-> (-> (Injection it) (Injection it))
(Injection it)))
(function (again value)
(body again value)))
(function (of value)
(body of value)))

(the .public any
(Injection Any)
Expand Down Expand Up @@ -298,7 +298,7 @@
(the .public type
(Injection Type)
(..rec
(function (_ again)
(function (_ of)
(let [indexed (..and ..bit ..natural)]
(function (_ altV)
(`` (when altV
Expand All @@ -312,12 +312,12 @@
[(.++ offset)]
caseT))])]

[[0 .:Nominal (..and ..text (..list (..and ..bit again)))]
[[0 .:Nominal (..and ..text (..list (..and ..bit of)))]
[1 .:Parameter indexed]
[2 .:Variable indexed]
[3 .:Quantification (all ..and ..bit (..stack (..and again again)) again)]
[4 .:Reification (..and again again)]
[5 .:Named (..and ..name again)]]))
[3 .:Quantification (all ..and ..bit (..stack (..and of of)) of)]
[4 .:Reification (..and of of)]
[5 .:Named (..and ..name of)]]))
)))))))

(the .public provenance
Expand Down
20 changes: 10 additions & 10 deletions stdlib/source/library/lux.lux
Original file line number Diff line number Diff line change
Expand Up @@ -3126,12 +3126,12 @@
(.when# value
[0] "0"
_ (let' [loop (.is# (-> Natural ($ Change Text))
(function' (again input output)
(function' (of input output)
(if (.i64_=# 0 input)
output
(again (natural:/ 10 input)
(text (|> input (natural:% 10) digit:injection)
output)))))]
(of (natural:/ 10 input)
(text (|> input (natural:% 10) digit:injection)
output)))))]
(loop value ""))))

(the' .private (integer:abs value)
Expand All @@ -3149,12 +3149,12 @@
"+"
"-")]
((.is# (-> Integer ($ Change Text))
(function' (again input output)
(function' (of input output)
(if (.i64_=# +0 input)
(text sign output)
(again (.int_/# +10 input)
(text (|> input (.int_%# +10) (.as# (-> Integer Natural)) digit:injection)
output)))))
(of (.int_/# +10 input)
(text (|> input (.int_%# +10) (.as# (-> Integer Natural)) digit:injection)
output)))))
(|> value (.int_/# +10) integer:abs)
(|> value (.int_%# +10) integer:abs (.as# (-> Integer Natural)) digit:injection)))))

Expand Down Expand Up @@ -4582,10 +4582,10 @@
(-> Text Text
(Change Text))
((is (-> Text (Change Text))
(function (again left right)
(function (of left right)
(when (..text:split_by pattern right)
{:Some [pre post]}
(again (text left pre replacement) post)
(of (text left pre replacement) post)

{:None}
(text left right))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
(for_any (_ anchor expression declaration)
(-> //.Wrapper (Extender anchor expression declaration) Expander
(Phase anchor expression declaration)))
(function (again archive code)
(function (of archive code)
(monad.let [! //.monad]
[state //.state
.let [analysis (its [/.:analysis /.:phase] state)
Expand All @@ -132,7 +132,7 @@
[macro|extension (macro_or_extension analysis archive code term)
expansion|requirements (let [inputs (list.after 1 it)]
(extension.reification extender
(its [/.:analysis /.:state] state) again archive
(its [/.:analysis /.:state] state) of archive
.Declaration macro|extension inputs
(|>> {:Done})
(function (_ _)
Expand All @@ -145,11 +145,11 @@
{:More expansion}
(when (list.item 0 expansion)
{try.:Success <lux_def_module>}
(|> (again archive <lux_def_module>)
(|> (of archive <lux_def_module>)
(by ! each (revised /.:referrals (list:composite (list.after 1 expansion)))))

_
(..requiring again archive expansion))
(..requiring of archive expansion))

{:Done requirements}
(pure requirements)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,10 @@
(with extension/lux.f64_x (binary ..f64:x))
(with extension/lux.f64_/ (binary ..f64:/))
(with extension/lux.f64_% (binary ..f64:%))

(with extension/lux.f64_= (binary ..f64:=))
(with extension/lux.f64_< (binary ..f64:<))

(with extension/lux.f64_int (unary ..f64:i64))))

(the $String:length
Expand Down Expand Up @@ -428,6 +430,7 @@
(Change Bundle)
(|>> (with extension/lux.text_= (binary ..text:=))
(with extension/lux.text_< (binary ..text:<))

(with extension/lux.text_composite (variadic ..text:composite))
(with extension/lux.text_index (trinary ..text:index))
(with extension/lux.text_size (unary ..text:size))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
["[0]" phase]
["[1][0]" translation]
["[0]" synthesis (.only Path)
["<[1]>" \\projection (.only Projection)]]
["<[1]>" \\projection (.only Projection)]
["[0]" path]]
[///
["@[0]" type (.only Register Variable Environment)]
[meta
Expand Down Expand Up @@ -794,11 +795,11 @@
[_ [@ {synthesis.:Control {synthesis.:When _ path}}]]
(loop (of [path (is Path path)])
(when path
{synthesis.:And _ next}
{path.:And _ next}
(of next)

... TO DO: Stop doing the ^.multi
(^.multi {synthesis.:Then path}
(^.multi {path.:Then path}
[path (synthesis.tuple @ (list _ hidden))])
hidden

Expand All @@ -813,37 +814,37 @@
(-> Path Path))
(function (of it)
(`` (when it
(^.or {synthesis.:Pop}
{synthesis.:Access _}
{synthesis.:List size})
(^.or {path.:Pop}
{path.:Access _}
{path.:List size})
it

{synthesis.:Bind it}
{synthesis.:Bind (-- it)}
{path.:Bind it}
{path.:Bind (-- it)}

{synthesis.:Bit_Fork when then else}
{synthesis.:Bit_Fork when
(of then)
(maybe:each of else)}
{path.:Bit_Fork when then else}
{path.:Bit_Fork when
(of then)
(maybe:each of else)}

(,, (template.with [<tag>]
[{<tag> [head tail]}
{<tag> [(revised synthesis.:then of head)
(list:each (revised synthesis.:then of) tail)]}]
{<tag> [(revised path.:then of head)
(list:each (revised path.:then of) tail)]}]

[[synthesis.:I64_Fork]
[synthesis.:F64_Fork]
[synthesis.:Text_Fork]]))
[[path.:I64_Fork]
[path.:F64_Fork]
[path.:Text_Fork]]))

(,, (template.with [<tag>]
[{<tag> left right}
{<tag> (of left) (of right)}]

[[synthesis.:Or]
[synthesis.:And]]))
[[path.:Or]
[path.:And]]))

{synthesis.:Then it}
{synthesis.:Then (without_fake_parameter it)}))))
{path.:Then it}
{path.:Then (without_fake_parameter it)}))))

(the .public (without_fake_parameter it)
(-> synthesis.Term
Expand Down Expand Up @@ -947,27 +948,27 @@
(-> Path Path))
(function (of path)
(`` (when path
(synthesis.path/then bodyS)
(synthesis.path/then (normalize bodyS))
{path.:Then bodyS}
{path.:Then (normalize bodyS)}

(,, (template.with [<tag>]
[{<tag> leftP rightP}
{<tag> (of leftP) (of rightP)}]

[[synthesis.:Or]
[synthesis.:And]]))
[[path.:Or]
[path.:And]]))

(,, (template.with [<tag>]
[{<tag> _}
path]

[[synthesis.:Pop]
[synthesis.:Bind]
[synthesis.:Access]
[synthesis.:List]]))
[[path.:Pop]
[path.:Bind]
[path.:Access]
[path.:List]]))

{synthesis.:Bit_Fork when then else}
{synthesis.:Bit_Fork when (of then) (maybe:each of else)}
{path.:Bit_Fork when then else}
{path.:Bit_Fork when (of then) (maybe:each of else)}

(,, (template.with [<tag>]
[{<tag> [[exampleH nextH] tail]}
Expand All @@ -976,9 +977,9 @@
[example (of next)])
tail)]}]

[[synthesis.:I64_Fork]
[synthesis.:F64_Fork]
[synthesis.:Text_Fork]]))
[[path.:I64_Fork]
[path.:F64_Fork]
[path.:Text_Fork]]))
))))

(every Mapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
["[0]" //
["[1][0]" loop (.only Transform)]
["//[1]" ///
["/" synthesis (.only Path Abstraction Operation Phase)]
["/" synthesis (.only Path Abstraction Operation Phase)
["[0]" path]]
["[0]" phase (.use "[1]:[0]" monad)]
["[0]" analysis]
[///
Expand Down Expand Up @@ -97,8 +98,8 @@
(-> (-> /.Term (Operation /.Term)) Path
(Operation Path))
(`` (when path
{/.:Bind register}
(phase:pure {/.:Bind (++ register)})
{path.:Bind register}
(phase:pure {path.:Bind (++ register)})

(,, (template.with [<tag>]
[{<tag> left right}
Expand All @@ -107,10 +108,10 @@
right' (grow_path grow right)]
(pure {<tag> left' right'}))]

[[/.:Or]
[/.:And]]))
[[path.:Or]
[path.:And]]))

{/.:Bit_Fork test then else}
{path.:Bit_Fork test then else}
(monad.let [! phase.monad]
[then (grow_path grow then)
else (when else
Expand All @@ -119,7 +120,7 @@

{.:None}
(pure {.:None}))]
(pure {/.:Bit_Fork test then else}))
(pure {path.:Bit_Fork test then else}))

(,, (template.with [<tag>]
[{<tag> [[test then] elses]}
Expand All @@ -132,15 +133,15 @@
elses)]
(pure {<tag> [[test then] elses]}))]

[[/.:I64_Fork]
[/.:F64_Fork]
[/.:Text_Fork]]
[[path.:I64_Fork]
[path.:F64_Fork]
[path.:Text_Fork]]
))

{/.:Then thenS}
{path.:Then thenS}
(|> thenS
grow
(phase:each (|>> {/.:Then})))
(phase:each (|>> {path.:Then})))

_
(phase:pure path))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
["[0]" expansion]
["[0]" template]]]]
[////
["/" synthesis (.only Path Abstraction)]
["/" synthesis (.only Path Abstraction)
["[0]" path]]
[///
[arity (.only Arity)]
["@[0]" type (.only Register Variable Environment)]
Expand All @@ -41,8 +42,8 @@
(Transform Path))
(function (of path)
(`` (when path
{/.:Bind register}
{.:Some {/.:Bind (register_optimization offset register)}}
{path.:Bind register}
{.:Some {path.:Bind (register_optimization offset register)}}

(,, (template.with [<tag>]
[{<tag> left right}
Expand All @@ -51,10 +52,10 @@
right' (of right)]
(pure {<tag> left' right'}))]

[[/.:Or]
[/.:And]]))
[[path.:Or]
[path.:And]]))

{/.:Bit_Fork test then else}
{path.:Bit_Fork test then else}
(monad.let [! maybe.monad]
[then (of then)
else (when else
Expand All @@ -63,7 +64,7 @@

{.:None}
(pure {.:None}))]
(pure {/.:Bit_Fork test then else}))
(pure {path.:Bit_Fork test then else}))

(,, (template.with [<tag>]
[{<tag> [[test then] elses]}
Expand All @@ -76,14 +77,14 @@
elses)]
(pure {<tag> [[test then] elses]}))]

[[/.:I64_Fork]
[/.:F64_Fork]
[/.:Text_Fork]]))
[[path.:I64_Fork]
[path.:F64_Fork]
[path.:Text_Fork]]))

{/.:Then body}
{path.:Then body}
(|> body
body_optimization
(maybe:each (|>> {/.:Then})))
(maybe:each (|>> {path.:Then})))

_
{.:Some path}))))
Expand Down
Loading

0 comments on commit bd5ae04

Please sign in to comment.