Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into filter-debug-keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyfettes committed Nov 26, 2024
2 parents b28c260 + 297b04b commit f131925
Show file tree
Hide file tree
Showing 56 changed files with 1,966 additions and 729 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ setup.log

# Backup of opam lock file
hazel.opam.locked.old

# Code coverage
_coverage/
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ setup-student:

dev-helper:
dune fmt --auto-promote || true
dune build @src/fmt --auto-promote src --profile dev
dune build @ocaml-index @src/fmt --auto-promote src --profile dev

dev: setup-instructor dev-helper

Expand All @@ -35,7 +35,7 @@ fmt:
dune fmt --auto-promote

watch: setup-instructor
dune build @src/fmt --auto-promote src --profile dev --watch
dune build @ocaml-index @src/fmt --auto-promote src --profile dev --watch

watch-release: setup-instructor
dune build @src/fmt --auto-promote src --profile release --watch
Expand All @@ -60,11 +60,19 @@ repl:

test:
dune fmt --auto-promote || true
dune build @src/fmt @test/fmt --auto-promote src test --profile dev
dune build @ocaml-index @src/fmt @test/fmt --auto-promote src test --profile dev
node $(TEST_DIR)/haz3ltest.bc.js

watch-test:
dune build @fmt @runtest --auto-promote --watch
dune build @ocaml-index @fmt @runtest --auto-promote --watch

coverage:
dune build @src/fmt @test/fmt --auto-promote src test --profile dev
dune runtest --instrument-with bisect_ppx --force
bisect-ppx-report summary

generate-coverage-html:
bisect-ppx-report html

clean:
dune clean
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ You can run all of the unit tests located in `test` by running `make test`.

Unit tests are written using the [Alcotest framework](https://github.com/mirage/alcotest).

#### Coverage
Code coverage is provided by [bisect_ppx](https://github.com/aantron/bisect_ppx). To collect coverage statistics from tests run `make coverage`. After coverage statistics are generated, running `make generate-coverage-html` will generate a local webpage at `_coverage/index.html` that can be viewed to see line coverage per module.

### Continuous Integration

When you push your branch to the main `hazelgrove/hazel` repository, we
Expand Down
7 changes: 4 additions & 3 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@
(menhir
(>= 2.0))
yojson
reason
(reason (>= 3.12.0))
ppx_yojson_conv_lib
ppx_yojson_conv
incr_dom
bisect_ppx
(omd (>= 2.0.0~alpha4))
ezjs_idb
virtual_dom
bonsai
ppx_deriving
ptmap
uuidm
(uuidm (= 0.9.8)) ; 0.9.9 has breaking deprecated changes
unionFind
ocamlformat
(junit_alcotest :with-test)
Expand Down
10 changes: 10 additions & 0 deletions dune-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(lang dune 3.16)

; List of warning codes found at https://ocaml.org/manual/5.2/comp.html#s:comp-options
(env
(dev
(flags
(:standard -warn-error +A-26-27-K-58))) ; Disable some unused warnings.
(release
(flags
(:standard -warn-error +A-58))))
7 changes: 4 additions & 3 deletions hazel.opam

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

107 changes: 79 additions & 28 deletions hazel.opam.locked

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/haz3lcore/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
(name haz3lcore)
(libraries util sexplib unionFind uuidm virtual_dom yojson core)
(js_of_ocaml)
(instrumentation
(backend bisect_ppx))
(preprocess
(pps
ppx_yojson_conv
Expand Down
21 changes: 10 additions & 11 deletions src/haz3lcore/dynamics/Builtins.re
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ let fn =
module Pervasives = {
module Impls = {
/* constants */
let infinity = DHExp.Float(Float.infinity) |> fresh;
let neg_infinity = DHExp.Float(Float.neg_infinity) |> fresh;
let nan = DHExp.Float(Float.nan) |> fresh;
let epsilon_float = DHExp.Float(epsilon_float) |> fresh;
let pi = DHExp.Float(Float.pi) |> fresh;
let max_int = DHExp.Int(Int.max_int) |> fresh;
let min_int = DHExp.Int(Int.min_int) |> fresh;
let infinity = Float(Float.infinity) |> fresh;
let neg_infinity = Float(Float.neg_infinity) |> fresh;
let nan = Float(Float.nan) |> fresh;
let epsilon_float = Float(epsilon_float) |> fresh;
let pi = Float(Float.pi) |> fresh;
let max_int = Int(Int.max_int) |> fresh;
let min_int = Int(Int.min_int) |> fresh;

let unary = (f: DHExp.t => result, d: DHExp.t) => {
switch (f(d)) {
Expand Down Expand Up @@ -180,8 +180,8 @@ module Pervasives = {
switch (convert(s)) {
| Some(n) => Ok(wrap(n))
| None =>
let d' = DHExp.BuiltinFun(name) |> DHExp.fresh;
let d' = DHExp.Ap(Forward, d', d) |> DHExp.fresh;
let d' = BuiltinFun(name) |> DHExp.fresh;
let d' = Ap(Forward, d', d) |> DHExp.fresh;
let d' = DynamicErrorHole(d', InvalidOfString) |> DHExp.fresh;
Ok(d');
}
Expand All @@ -204,8 +204,7 @@ module Pervasives = {
Ok(
fresh(
DynamicErrorHole(
DHExp.Ap(Forward, DHExp.BuiltinFun(name) |> fresh, d1)
|> fresh,
Ap(Forward, BuiltinFun(name) |> fresh, d1) |> fresh,
DivideByZero,
),
),
Expand Down
Loading

0 comments on commit f131925

Please sign in to comment.