Skip to content

Commit

Permalink
Improving test coverage [part 6]
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Sep 22, 2024
1 parent 8472aa2 commit 7d60325
Show file tree
Hide file tree
Showing 70 changed files with 752 additions and 386 deletions.
1 change: 1 addition & 0 deletions documentation/bookmark/compilation/target/c++.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

# Reference

0. [InstantC](https://gitlab.com/jlinhoff/instantc)
0. [Lightning Talk: Writing a Better std::move - Jonathan Müller - CppCon 2023](https://www.youtube.com/watch?v=hvnl6T2MnUk)
0. [CppCon 2018: Tom Poole “Why and How to Roll Your Own std::function Implementation”](https://www.youtube.com/watch?v=VY83afAJUIg)
0. [Writing custom C++20 coroutine systems](https://www.chiark.greenend.org.uk/~sgtatham/quasiblog/coroutines-c++20/)
Expand Down
1 change: 1 addition & 0 deletions documentation/bookmark/compilation/target/c.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Reference

0. [InstantC](https://gitlab.com/jlinhoff/instantc)
0. [Can you use a class in C?](https://thasso.xyz/2023/08/11/can-you-use-a-class-in-c/)
0. [Few lesser known tricks, quirks and features of C](https://jorengarenar.github.io/blog/less-known-c)
0. [Portability and the C Language](https://en.wikibooks.org/wiki/Portability_and_the_C_Language)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

# Exemplar

0. []()
0. [Announcing GraalWasm — a WebAssembly engine in GraalVM](https://medium.com/graalvm/announcing-graalwasm-a-webassembly-engine-in-graalvm-25cd0400a7f2)
0. [Towards a WebAssembly standalone runtime on GraalVM](https://dl.acm.org/citation.cfm?id=3362780)
0. https://github.com/vvanders/wasm_lua
Expand All @@ -25,6 +24,7 @@

# Reference

0. [GraalWasm: A high-performance embeddable WebAssembly runtime for Java](https://www.graalvm.org/webassembly/)
0. [Awesome WebAssembly runtimes](https://github.com/jcbhmr/awesome-webassembly-runtimes)
0. [Chicory Runtime](https://github.com/dylibso/chicory)
0. [A zero dependency Wasm runtime for the JVM](https://www.javaadvent.com/2023/12/chicory-wasm-jvm.html)
Expand Down
1 change: 1 addition & 0 deletions documentation/bookmark/investing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Reference

0. [The Ultimate Investors List of Lists: Venture Capital funds, Family Offices, Accelerators, CVCs, and Angel Investors](https://thevccorner.substack.com/p/the-ultimate-investor-list-of-lists)
0. [3 Investing Patterns That You Should Know](https://behavioralvalueinvestor.substack.com/p/3-investing-patterns-that-you-should)
0. [Predictably Bad Investments: Evidence from Venture Capitalists](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4135861)
0. [Launch YC: The Launchpad for YC Startups](https://www.ycombinator.com/blog/launch-yc-the-launchpad-for-yc-startups)
Expand Down
4 changes: 4 additions & 0 deletions documentation/bookmark/play/game/mechanic/luck.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Reference

0. [What Makes A Good Luck Mechanic?](https://youtu.be/4cmGSMDOrfc)

14 changes: 8 additions & 6 deletions lux-ruby/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
["[1]" ruby]]]]
["[0]" world
["[0]" file]
["[1]/[0]" environment]]]]
["[1]/[0]" environment]]
[aspect
["[0]" view]]]]
[program
["/" compositor]])

Expand Down Expand Up @@ -911,7 +913,7 @@
[info source provenance current_module modules scopes type_context expected seed eval])))

_
(exception.except ..invaid_phase_application [(list.of_stack partial_application) inputs]))
(exception.except ..invaid_phase_application [(view.of list.stack partial_application) inputs]))

(list)
{try.#Success (<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
Expand All @@ -934,7 +936,7 @@
input/0)))

_
(exception.except ..invaid_phase_application [(list.of_stack partial_application) inputs]))
(exception.except ..invaid_phase_application [(view.of list.stack partial_application) inputs]))

(list input/0 input/1)
(when partial_application
Expand All @@ -949,7 +951,7 @@
input/1)))

_
(exception.except ..invaid_phase_application [(list.of_stack partial_application) inputs]))
(exception.except ..invaid_phase_application [(view.of list.stack partial_application) inputs]))

(list input/0 input/1 input/2)
(when partial_application
Expand All @@ -960,10 +962,10 @@
input/2)))

_
(exception.except ..invaid_phase_application [(list.of_stack partial_application) inputs]))
(exception.except ..invaid_phase_application [(view.of list.stack partial_application) inputs]))

_
(exception.except ..invaid_phase_application [(list.of_stack partial_application) inputs])))))]
(exception.except ..invaid_phase_application [(view.of list.stack partial_application) inputs])))))]
(org/jruby/RubyProc::newProc [(!ruby_runtime) block ..proc_type])))

(the phase_wrapper
Expand Down
18 changes: 8 additions & 10 deletions stdlib/source/injection/lux/data/text.lux
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
[arithmetic
["[0]" modular]]]
[macro
["[0]" template]]]])
["[0]" template]]
[aspect
["[0]" view]]]])

(template.with [<name> <type> <injection>]
[(the .public <name>
Expand All @@ -36,8 +38,7 @@
[integer Integer (by integer.base_10 as)]
[revolution Revolution (by revolution.base_10 as)]
[decimal Decimal (by decimal.base_10 as)]
[text Text text.as_text]]
)
[text Text text.as_text]])

(template.with [,name]
[(the .public ,name
Expand All @@ -52,17 +53,15 @@
[[degree]
[per_cent]
[per_mille]
[per_myriad]]
)
[per_myriad]])

(template.with [<type> <injection>,<format>]
[(`` (template.with [<injection> <format>]
[(the .public <injection>
(Injection <type>)
(by <format> as))]

<injection>,<format>
))]
<injection>,<format>))]

[[Natural
[[natural_02 natural.base_02]
Expand All @@ -83,8 +82,7 @@
[[decimal_02 decimal.base_02]
[decimal_08 decimal.base_08]
[decimal_10 decimal.base_10]
[decimal_16 decimal.base_16]]]]
)
[decimal_16 decimal.base_16]]]])

(the .public (padded padding as)
(-> Natural (Injection Natural)
Expand All @@ -104,7 +102,7 @@
(for_any (_ it)
(-> (Injection it)
(Injection (Stack it))))
(|>> list.of_stack
(|>> (view.of list.stack)
(list#each (|>> as (.text " ")))
text.together
(text.enclosed ["(stack" ")"])))
Expand Down
25 changes: 16 additions & 9 deletions stdlib/source/library/lux/aspect/view.lux
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
... [Profunctor Optics: Modular Data Accessors](https://arxiv.org/abs/1703.10857)
(.using
[library
[lux (.except macro
as)
[lux (.except macro as with)
[abstract
[functor
["[0]" pro]]]
Expand All @@ -16,10 +15,6 @@
(<| (.in_module# .prelude)
.template#macro))

(the with_template
(<| (.in_module# .prelude)
.with_template))

(the Of'
(macro (_ context context'
analogy analogy')
Expand Down Expand Up @@ -61,6 +56,10 @@
[#of of
#as as])

(the with_template
(<| (.in_module# .prelude)
.with_template))

(with_template [,name ,type ,tag]
[(the .public ,name
(for_any (_ context analogy)
Expand All @@ -69,8 +68,7 @@
(.its ,tag))]

[[of Of #of]
[as As #as]]
)
[as As #as]])

(the .public identity
(for_any (_ it)
Expand All @@ -97,7 +95,7 @@
(for_any (_ context context' analogy analogy')
(-> (View' context context' analogy analogy')
(Aspect context context' analogy analogy')))
(<| (with pro_functor)
(<| (.with pro_functor)
(each /#as /#of)))

(the .public (of_aspect =>)
Expand All @@ -108,3 +106,12 @@
(=> [..functor]
[#of function.identity
#as function.identity]))

(the .public (with it change)
(for_any (_ context analogy)
(-> (View context analogy)
(-> (Change analogy)
(Change context))))
(|>> (as it)
change
(of it)))
6 changes: 4 additions & 2 deletions stdlib/source/library/lux/compiler/default/platform.lux
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
["[1]/[0]" module]]
[world
["[0]" file (.only Path)]
["[0]" console]]]]
["[0]" console]]
[aspect
["[0]" view]]]]
["[0]" //
["[1][0]" init]
["/[1]" // (.only)
Expand Down Expand Up @@ -724,7 +726,7 @@
compilation_sources
(its context.#host_module_extension context)
module)]
(loop (again [customs (list.as_stack all_customs)])
(loop (again [customs (view.as list.stack all_customs)])
(when customs
{.#Empty}
((..lux_compiler import context platform compilation_sources configuration compiler (compiler input))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
[macro
["^" pattern]
["[0]" template]
["[0]" expansion]]]]
["[0]" expansion]]
[aspect
["[0]" view]]]]
["[0]" //
["[1][0]" simple]
["[1][0]" complex]
Expand Down Expand Up @@ -134,8 +136,8 @@
(and (n.= (stack.size flatR) (stack.size flatS))
(list.every? (function (_ [coverageR coverageS])
(= coverageR coverageS))
(list.zipped_2 (list.of_stack flatR)
(list.of_stack flatS)))))
(list.zipped_2 (view.of list.stack flatR)
(view.of list.stack flatS)))))

_
false)))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
["[0]" check]]
["[0]" meta (.only)
["[0]" code]
["[0]" module]]]]
["[0]" module]]
[aspect
["[0]" view]]]]
["/" // (.only Operation Phase)
["[1][0]" type]
[//
Expand Down Expand Up @@ -99,7 +101,7 @@
(Operation Nothing))
(do phase.monad
[here module.current_name]
(/.except ..cannot_infer [here inference (list.of_stack arguments)])))
(/.except ..cannot_infer [here inference (view.of list.stack arguments)])))

... Type-inference works by applying some (potentially quantified) type
... to a sequence of values.
Expand Down Expand Up @@ -249,11 +251,11 @@
(|> it
type.flat_variant
(list.after lefts)
list.as_stack
(view.as list.stack)
(pipe.when
{.#Top head tail}
(let [case (if right?
(type.variant (list.of_stack tail))
(type.variant (view.of list.stack tail))
head)]
(-> (if (n.= 0 depth)
case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
["[0]" property]]
["[0]" stack (.use "[1]#[0]" functor mix monoid)]]]
[compiler
["@[0]" type]]]]
["@[0]" type]]
[aspect
["[0]" view]]]]
["/" // (.only Environment Operation Phase)
[//
["[0]" phase]
Expand Down Expand Up @@ -63,7 +65,9 @@
(-> Text @type.Scope
(Maybe [@type.Type Variable]))
(loop (again [idx 0
mappings (list.as_stack (its [@type.#captured @type.#mappings] scope))])
mappings (|> scope
(its [@type.#captured @type.#mappings])
(view.as list.stack))])
(when mappings
{.#Top [_name [_source_type _source_ref]] mappings'}
(if (text.= name _name)
Expand Down
18 changes: 10 additions & 8 deletions stdlib/source/library/lux/compiler/language/lux/phase/analysis.lux
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
["[0]" binding]
["[0]" provenance]
["[0]" code]
["[0]" module]]]]
["[0]" module]]
[aspect
["[0]" view]]]]
["[0]" /
["[1][0]" simple]
["[1][0]" complex]
Expand Down Expand Up @@ -169,15 +171,15 @@

{#Macro name macro}
(do !
[expansion (/macro.single_expansion expander name macro (list.of_stack argsC+))]
[expansion (/macro.single_expansion expander name macro (view.of list.stack argsC+))]
(analysis archive expansion))

{#Extension abstraction}
(do !
[lux //.state]
(extension.reification extender
lux analysis archive
.Analysis abstraction (list.of_stack argsC+)
.Analysis abstraction (view.of list.stack argsC+)
(|>>)
(function (_ _) {.#None})))))]))

Expand Down Expand Up @@ -206,23 +208,23 @@
(/reference.reference extender analysis archive quoted_module it)

{@type.#Form _ elems}
(when (list.as_stack elems)
(when (view.as list.stack elems)
(stack.partial functionC argsC+)
(..reification extender expander analysis archive functionC argsC+)

_
failure)

{@type.#Variant _ elems}
(when (list.as_stack elems)
(when (view.as list.stack elems)
(stack.partial {@type.#Name _ tag} values)
(..variant_analysis analysis archive tag (list.of_stack values))
(..variant_analysis analysis archive tag (view.of list.stack values))

(stack.partial {@type.#Bit _ right?} values)
(..sum_analysis analysis archive 0 right? (list.of_stack values))
(..sum_analysis analysis archive 0 right? (view.of list.stack values))

(stack.partial {@type.#Natural _ lefts} {@type.#Bit _ right?} values)
(..sum_analysis analysis archive lefts right? (list.of_stack values))
(..sum_analysis analysis archive lefts right? (view.of list.stack values))

_
failure)
Expand Down
Loading

0 comments on commit 7d60325

Please sign in to comment.