-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from vch9/dev
Version 0.3
- Loading branch information
Showing
36 changed files
with
1,252 additions
and
699 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,6 @@ setup.log | |
|
||
# Local OPAM switch | ||
_opam/ | ||
|
||
# Coverage | ||
_coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
all: build | ||
|
||
build: | ||
@dune build | ||
|
||
test: | ||
@dune runtest | ||
|
||
coverage: | ||
@dune runtest --instrument-with bisect_ppx --force | ||
bisect-ppx-report html | ||
firefox _coverage/index.html | ||
|
||
clean: | ||
@dune clean | ||
rm -rf _coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ "name": "exponentiation", | ||
"scenarios": | ||
[ [ 0, [ 5, 0 ] ], [ 0, [ 5, 0 ] ], [ 1, [ 0, 1 ] ], [ 4, [ 4, 256 ] ], | ||
[ 0, [ 1, 0 ] ] ] } |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
(executables | ||
(names interactive promote error) | ||
(executable | ||
(name exponentiation) | ||
(libraries osnap)) | ||
|
||
(rule | ||
(alias runtest) | ||
(action (run %{exe:exponentiation.exe}))) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
(* let rec exponentiation x n = | ||
* if n = 0 then 1 else if n = 1 then x else exponentiation x (n - 1) * x *) | ||
|
||
let rec binary_expo x n = | ||
if n = 0 then 1 | ||
else if n mod 2 = 0 then | ||
let tmp = binary_expo x (n / 2) in | ||
tmp * tmp | ||
else x * binary_expo x (n - 1) | ||
|
||
let test = | ||
let open Osnap in | ||
let small_int = | ||
Spec. | ||
{ | ||
gen = QCheck.Gen.(0 -- 5); | ||
printer = Some string_of_int; | ||
encoding = Some Data_encoding.int31; | ||
} | ||
in | ||
let spec = Spec.(small_int ^> small_int ^>> Result.int) in | ||
|
||
Test.make ~spec ~count:5 ~name:"exponentiation" binary_expo | ||
|
||
let _ = Osnap.Runner.(run_tests ~encoding:Data_encoding ~mode:Error [ test ]) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
(library | ||
(name osnap) | ||
(public_name osnap) | ||
(preprocess | ||
(pps ppx_deriving.show)) | ||
(libraries qcheck patdiff ppx_deriving)) | ||
(libraries str qcheck-core data-encoding) | ||
(instrumentation (backend bisect_ppx))) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.