Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ bin/configlet
.psc-ide-port

.merlin
_opam
_opam

node_modules
Copy link
Member

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.

84 changes: 0 additions & 84 deletions bin/add-practice-exercise

This file was deleted.

8 changes: 8 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,14 @@
"prerequisites": [],
"difficulty": 3
},
{
"slug": "darts",
"name": "Darts",
"uuid": "c6b23754-4410-4450-81fc-a7d53278cff5",
"practices": [],
"prerequisites": [],
"difficulty": 2
},
{
"slug": "collatz-conjecture",
"name": "Collatz Conjecture",
Expand Down
6 changes: 0 additions & 6 deletions exercises/practice/anagram/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ let tests = [
"no matches" >::
ae [] (anagrams "diaper" ["hello"; "world"; "zombies"; "pants"]);
"detects two anagrams" >::
ae ["stream"; "maters"] (anagrams "master" ["stream"; "pigeon"; "maters"]);
"detects two anagrams" >::
ae ["lemons"; "melons"] (anagrams "solemn" ["lemons"; "cherry"; "melons"]);
"does not detect anagram subsets" >::
ae [] (anagrams "good" ["dog"; "goody"]);
Expand All @@ -33,17 +31,13 @@ let tests = [
ae [] (anagrams "go" ["go Go GO"]);
"anagrams must use all letters exactly once" >::
ae [] (anagrams "tapper" ["patter"]);
"words are not anagrams of themselves (case-insensitive)" >::
ae [] (anagrams "BANANA" ["BANANA"; "Banana"; "banana"]);
"words are not anagrams of themselves" >::
ae [] (anagrams "BANANA" ["BANANA"]);
"words are not anagrams of themselves even if letter case is partially different" >::
ae [] (anagrams "BANANA" ["Banana"]);
"words are not anagrams of themselves even if letter case is completely different" >::
ae [] (anagrams "BANANA" ["banana"]);
"words other than themselves can be anagrams" >::
ae ["Silent"] (anagrams "LISTEN" ["Listen"; "Silent"; "LISTEN"]);
"words other than themselves can be anagrams" >::
ae ["Silent"] (anagrams "LISTEN" ["LISTEN"; "Silent"]);
]

Expand Down
30 changes: 18 additions & 12 deletions exercises/practice/collatz-conjecture/test.ml
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)
2 changes: 1 addition & 1 deletion exercises/practice/etl/dune-project
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)
42 changes: 0 additions & 42 deletions exercises/practice/pangram/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ let tests = [
ae false (is_pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
"mixed case and punctuation" >::
ae true (is_pangram "\"Five quacking Zephyrs jolt my wax bed.\"");
"case insensitive" >::
ae false (is_pangram "the quick brown fox jumps over with lazy FX");
"a-m and A-M are 26 different characters but not a pangram" >::
ae false (is_pangram "abcdefghijklm ABCDEFGHIJKLM");
"empty sentence" >::
Expand All @@ -44,8 +42,6 @@ let tests = [
ae false (is_pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
"mixed case and punctuation" >::
ae true (is_pangram "\"Five quacking Zephyrs jolt my wax bed.\"");
"case insensitive" >::
ae false (is_pangram "the quick brown fox jumps over with lazy FX");
"a-m and A-M are 26 different characters but not a pangram" >::
ae false (is_pangram "abcdefghijklm ABCDEFGHIJKLM");
"empty sentence" >::
Expand All @@ -66,8 +62,6 @@ let tests = [
ae false (is_pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
"mixed case and punctuation" >::
ae true (is_pangram "\"Five quacking Zephyrs jolt my wax bed.\"");
"case insensitive" >::
ae false (is_pangram "the quick brown fox jumps over with lazy FX");
"a-m and A-M are 26 different characters but not a pangram" >::
ae false (is_pangram "abcdefghijklm ABCDEFGHIJKLM");
"empty sentence" >::
Expand All @@ -88,8 +82,6 @@ let tests = [
ae false (is_pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
"mixed case and punctuation" >::
ae true (is_pangram "\"Five quacking Zephyrs jolt my wax bed.\"");
"case insensitive" >::
ae false (is_pangram "the quick brown fox jumps over with lazy FX");
"a-m and A-M are 26 different characters but not a pangram" >::
ae false (is_pangram "abcdefghijklm ABCDEFGHIJKLM");
"empty sentence" >::
Expand All @@ -110,8 +102,6 @@ let tests = [
ae false (is_pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
"mixed case and punctuation" >::
ae true (is_pangram "\"Five quacking Zephyrs jolt my wax bed.\"");
"case insensitive" >::
ae false (is_pangram "the quick brown fox jumps over with lazy FX");
"a-m and A-M are 26 different characters but not a pangram" >::
ae false (is_pangram "abcdefghijklm ABCDEFGHIJKLM");
"empty sentence" >::
Expand All @@ -132,8 +122,6 @@ let tests = [
ae false (is_pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
"mixed case and punctuation" >::
ae true (is_pangram "\"Five quacking Zephyrs jolt my wax bed.\"");
"case insensitive" >::
ae false (is_pangram "the quick brown fox jumps over with lazy FX");
"a-m and A-M are 26 different characters but not a pangram" >::
ae false (is_pangram "abcdefghijklm ABCDEFGHIJKLM");
"empty sentence" >::
Expand All @@ -154,8 +142,6 @@ let tests = [
ae false (is_pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
"mixed case and punctuation" >::
ae true (is_pangram "\"Five quacking Zephyrs jolt my wax bed.\"");
"case insensitive" >::
ae false (is_pangram "the quick brown fox jumps over with lazy FX");
"a-m and A-M are 26 different characters but not a pangram" >::
ae false (is_pangram "abcdefghijklm ABCDEFGHIJKLM");
"empty sentence" >::
Expand All @@ -176,8 +162,6 @@ let tests = [
ae false (is_pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
"mixed case and punctuation" >::
ae true (is_pangram "\"Five quacking Zephyrs jolt my wax bed.\"");
"case insensitive" >::
ae false (is_pangram "the quick brown fox jumps over with lazy FX");
"a-m and A-M are 26 different characters but not a pangram" >::
ae false (is_pangram "abcdefghijklm ABCDEFGHIJKLM");
"empty sentence" >::
Expand All @@ -198,8 +182,6 @@ let tests = [
ae false (is_pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
"mixed case and punctuation" >::
ae true (is_pangram "\"Five quacking Zephyrs jolt my wax bed.\"");
"case insensitive" >::
ae false (is_pangram "the quick brown fox jumps over with lazy FX");
"a-m and A-M are 26 different characters but not a pangram" >::
ae false (is_pangram "abcdefghijklm ABCDEFGHIJKLM");
"empty sentence" >::
Expand All @@ -220,30 +202,6 @@ let tests = [
ae false (is_pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
"mixed case and punctuation" >::
ae true (is_pangram "\"Five quacking Zephyrs jolt my wax bed.\"");
"case insensitive" >::
ae false (is_pangram "the quick brown fox jumps over with lazy FX");
"a-m and A-M are 26 different characters but not a pangram" >::
ae false (is_pangram "abcdefghijklm ABCDEFGHIJKLM");
"empty sentence" >::
ae false (is_pangram "");
"perfect lower case" >::
ae true (is_pangram "abcdefghijklmnopqrstuvwxyz");
"only lower case" >::
ae true (is_pangram "the quick brown fox jumps over the lazy dog");
"missing the letter 'x'" >::
ae false (is_pangram "a quick movement of the enemy will jeopardize five gunboats");
"missing the letter 'h'" >::
ae false (is_pangram "five boxing wizards jump quickly at it");
"with underscores" >::
ae true (is_pangram "the_quick_brown_fox_jumps_over_the_lazy_dog");
"with numbers" >::
ae true (is_pangram "the 1 quick brown fox jumps over the 2 lazy dogs");
"missing letters replaced by numbers" >::
ae false (is_pangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog");
"mixed case and punctuation" >::
ae true (is_pangram "\"Five quacking Zephyrs jolt my wax bed.\"");
"case insensitive" >::
ae false (is_pangram "the quick brown fox jumps over with lazy FX");
"a-m and A-M are 26 different characters but not a pangram" >::
ae false (is_pangram "abcdefghijklm ABCDEFGHIJKLM");
]
Expand Down
Loading