-
-
Notifications
You must be signed in to change notification settings - Fork 55
Collatz conjecture #545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Collatz conjecture #545
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3341abe
add collatz-conjecture slug via newly added add-practice-exercise script
TheRealOwenRees 6d4753e
project files setup
TheRealOwenRees 5473b7e
added exercise with tests
TheRealOwenRees 894e080
exercise uuid added
TheRealOwenRees 44b02cd
delete mistakenly added files
TheRealOwenRees 1beea81
remove commented out code in test
TheRealOwenRees 26df8af
ignore node_modules that appear from time to time
TheRealOwenRees 5250a96
test generator template added
TheRealOwenRees 0f5265b
test template added
TheRealOwenRees aa31c68
filter original test cases whose UUID is referenced in reimplements i…
TheRealOwenRees 1bee45a
original test cases referenced by reimplements are deleted
TheRealOwenRees e4a1a9f
Merge branch 'main' into collatz-conjecture
TheRealOwenRees d47631e
does not need a set for filtering UUIDs
TheRealOwenRees 9e2cb7f
formatting fixes
TheRealOwenRees 9918b00
redelete node modules debug file
TheRealOwenRees File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -10,4 +10,6 @@ bin/configlet | |
| .psc-ide-port | ||
|
|
||
| .merlin | ||
| _opam | ||
| _opam | ||
|
|
||
| node_modules | ||
kahgoh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
kahgoh marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,20 +1,26 @@ | ||
| open Base | ||
| open OUnit2 | ||
| open Collatz_conjecture | ||
|
|
||
| (* Assert Equals *) | ||
| (* let ae exp got _test_ctxt = | ||
| assert_equal exp got *) | ||
| let ae expected actual _ctx = assert_equal expected actual | ||
| let option_printer = function | ||
| | Error m -> Printf.sprintf "Error \"%s\"" m | ||
| | Ok n -> Printf.sprintf "Ok %d" n | ||
|
|
||
| let ae exp got _test_ctxt = assert_equal ~printer:option_printer exp got | ||
|
|
||
| let tests = [ | ||
| "zero steps for one" >:: ae (Ok 0) (collatz_conjecture 1); | ||
| "divide if even" >:: ae (Ok 4) (collatz_conjecture 16); | ||
| "even and odd steps" >:: ae (Ok 9) (collatz_conjecture 12); | ||
| "large number of even and odd steps" >:: ae (Ok 152) (collatz_conjecture 1000000); | ||
| "zero is an error" >:: ae (Error "Only positive integers are allowed") (collatz_conjecture 0); | ||
| "negative value is an error" >:: ae (Error "Only positive integers are allowed") (collatz_conjecture (-15)); | ||
| "zero steps for one" >:: | ||
| ae (Ok 0) (collatz_conjecture (1)); | ||
| "divide if even" >:: | ||
| ae (Ok 4) (collatz_conjecture (16)); | ||
| "even and odd steps" >:: | ||
| ae (Ok 9) (collatz_conjecture (12)); | ||
| "large number of even and odd steps" >:: | ||
| ae (Ok 152) (collatz_conjecture (1000000)); | ||
| "zero is an error" >:: | ||
| ae (Error "Only positive integers are allowed") (collatz_conjecture (0)); | ||
| "negative value is an error" >:: | ||
| ae (Error "Only positive integers are allowed") (collatz_conjecture (-15)); | ||
| ] | ||
|
|
||
| let () = | ||
| run_test_tt_main ("collatz_conjecture tests" >::: tests) | ||
| run_test_tt_main ("collatz-conjecture tests" >::: tests) |
This file contains hidden or 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,2 +1,2 @@ | ||
| (lang dune 1.1) | ||
| (version 1.0.1) | ||
| (version 1.0) |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you've accidentally added
node_modules? Could you please remove.