trackler 2.0.8.51 → 2.0.8.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/cpp/.editorconfig +21 -0
- data/tracks/cpp/exercises/anagram/anagram_test.cpp +2 -1
- data/tracks/cpp/exercises/nucleotide-count/example.cpp +5 -1
- data/tracks/cpp/exercises/nucleotide-count/nucleotide_count_test.cpp +5 -0
- data/tracks/cpp/exercises/queen-attack/queen_attack_test.cpp +8 -5
- data/tracks/elixir/config.json +8 -0
- data/tracks/elixir/exercises/hello-world/hello_world.exs +1 -1
- data/tracks/elixir/exercises/scale-generator/example.exs +119 -0
- data/tracks/elixir/exercises/scale-generator/scale_generator.exs +83 -0
- data/tracks/elixir/exercises/scale-generator/scale_generator_test.exs +282 -0
- data/tracks/go/README.md +17 -4
- data/tracks/go/gen/gen.go +85 -15
- data/tracks/java/exercises/pascals-triangle/src/example/java/PascalsTriangleGenerator.java +21 -0
- data/tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java +86 -0
- data/tracks/javascript/.github/stale.yml +0 -0
- data/tracks/javascript/exercises/leap/HINT.md +52 -0
- data/tracks/javascript/exercises/leap/leap.js +6 -2
- data/tracks/objective-c/docs/TESTS.md +5 -4
- data/tracks/purescript/config.json +8 -0
- data/tracks/purescript/exercises/crypto-square/bower.json +18 -0
- data/tracks/purescript/exercises/crypto-square/examples/src/CryptoSquare.purs +63 -0
- data/tracks/purescript/exercises/crypto-square/src/CryptoSquare.purs +6 -0
- data/tracks/purescript/exercises/crypto-square/test/Main.purs +92 -0
- data/tracks/ruby/exercises/hello-world/.meta/.version +1 -1
- data/tracks/ruby/exercises/hello-world/example.tt +7 -5
- data/tracks/ruby/exercises/hello-world/hello_world_test.rb +4 -15
- data/tracks/ruby/lib/hello_world_cases.rb +5 -5
- metadata +14 -6
- data/tracks/clojurescript/.github/ISSUE_TEMPLATE.md +0 -9
- data/tracks/cpp/exercises/queen-attack/require_equal_containers.h +0 -88
- data/tracks/java/exercises/pascals-triangle/src/example/java/PascalsTriangle.java +0 -26
- data/tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java +0 -85
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b14ecd3a2ec9c1e8e23e8c7388b680666d46a2c
|
4
|
+
data.tar.gz: 9529b8cfff22f5305d62edfe36ac991781492715
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fcb8b7b14ce2bdf9eb5313f27ba798944841ce731f3ad534c298f3aa839056aed656abe140bac617660701dbdbcdc8ee6a72bda2a3950443717e6feae29a8a7
|
7
|
+
data.tar.gz: 4a11526fc3a68fdd5d1632da3291d63b37a436b228e5679060849ff0129ce0a5de7f02750167e72894eb66a0eb4c6f2657c7ce3d250d3c1381f0011704aec1c3
|
data/lib/trackler/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
#Editor Config is So awesome
|
3
|
+
|
4
|
+
#Indicate this is the config of the root
|
5
|
+
root = true
|
6
|
+
|
7
|
+
# Apply the following rules to these file types
|
8
|
+
[{*.{cpp,cc,c,h,hpp,txt}}]
|
9
|
+
end_of_line = lf #Unix type line endings
|
10
|
+
insert_final_newline = true
|
11
|
+
indent_style = space
|
12
|
+
indent_size = 4
|
13
|
+
trim_trailing_whitespace = true
|
14
|
+
|
15
|
+
#Separate Config for YML files
|
16
|
+
[*.yml]
|
17
|
+
end_of_line = lf
|
18
|
+
insert_final_newline = true
|
19
|
+
indent_style = space
|
20
|
+
indent_size = 2
|
21
|
+
trim_trailing_whitespace = true
|
@@ -6,7 +6,8 @@ using namespace std;
|
|
6
6
|
|
7
7
|
BOOST_AUTO_TEST_CASE(no_matches)
|
8
8
|
{
|
9
|
-
|
9
|
+
// 'anagram::anagram' defines a class
|
10
|
+
anagram::anagram subject = anagram::anagram("diaper");
|
10
11
|
auto matches = subject.matches({"hello", "world", "zombies", "pants"});
|
11
12
|
vector<string> expected;
|
12
13
|
|
@@ -8,7 +8,11 @@ counter::counter(std::string const& sequence)
|
|
8
8
|
: counts_({ {'A', 0}, {'C', 0}, {'G', 0}, {'T', 0} })
|
9
9
|
{
|
10
10
|
for (auto nucleotide : sequence) {
|
11
|
-
counts_
|
11
|
+
auto it = counts_.find(nucleotide);
|
12
|
+
if (it == counts_.end()) {
|
13
|
+
throw std::invalid_argument("Unknown nucleotide");
|
14
|
+
}
|
15
|
+
++(it->second);
|
12
16
|
}
|
13
17
|
}
|
14
18
|
|
@@ -62,6 +62,11 @@ BOOST_AUTO_TEST_CASE(validates_nucleotides)
|
|
62
62
|
BOOST_REQUIRE_THROW(dna.count('X'), std::invalid_argument);
|
63
63
|
}
|
64
64
|
|
65
|
+
BOOST_AUTO_TEST_CASE(validates_nucleotides_on_construction)
|
66
|
+
{
|
67
|
+
BOOST_REQUIRE_THROW(dna::counter("GGTTGGX"), std::invalid_argument);
|
68
|
+
}
|
69
|
+
|
65
70
|
BOOST_AUTO_TEST_CASE(counts_all_nucleotides)
|
66
71
|
{
|
67
72
|
const dna::counter dna("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC");
|
@@ -1,14 +1,15 @@
|
|
1
1
|
#include "queen_attack.h"
|
2
2
|
#define BOOST_TEST_MAIN
|
3
3
|
#include <boost/test/unit_test.hpp>
|
4
|
-
#include "require_equal_containers.h"
|
5
4
|
|
6
5
|
BOOST_AUTO_TEST_CASE(queens_in_default_positions)
|
7
6
|
{
|
8
7
|
const queen_attack::chess_board board;
|
9
8
|
|
10
|
-
BOOST_REQUIRE_EQUAL(std::make_pair(0, 3), board.white());
|
11
|
-
BOOST_REQUIRE_EQUAL(std::make_pair(
|
9
|
+
BOOST_REQUIRE_EQUAL(std::make_pair(0, 3).first, board.white().first);
|
10
|
+
BOOST_REQUIRE_EQUAL(std::make_pair(0, 3).second, board.white().second);
|
11
|
+
BOOST_REQUIRE_EQUAL(std::make_pair(7, 3).first, board.black().first);
|
12
|
+
BOOST_REQUIRE_EQUAL(std::make_pair(7, 3).second, board.black().second);
|
12
13
|
}
|
13
14
|
|
14
15
|
#if defined(EXERCISM_RUN_ALL_TESTS)
|
@@ -18,8 +19,10 @@ BOOST_AUTO_TEST_CASE(initialized_with_specific_positions)
|
|
18
19
|
const auto black = std::make_pair(6, 1);
|
19
20
|
const queen_attack::chess_board board{white, black};
|
20
21
|
|
21
|
-
BOOST_REQUIRE_EQUAL(white, board.white());
|
22
|
-
BOOST_REQUIRE_EQUAL(
|
22
|
+
BOOST_REQUIRE_EQUAL(white.first, board.white().first);
|
23
|
+
BOOST_REQUIRE_EQUAL(white.second, board.white().second);
|
24
|
+
BOOST_REQUIRE_EQUAL(black.first, board.black().first);
|
25
|
+
BOOST_REQUIRE_EQUAL(black.second, board.black().second);
|
23
26
|
}
|
24
27
|
|
25
28
|
BOOST_AUTO_TEST_CASE(queen_positions_must_be_distinct)
|
data/tracks/elixir/config.json
CHANGED
@@ -15,7 +15,7 @@ defmodule HelloWorld do
|
|
15
15
|
function?
|
16
16
|
|
17
17
|
Hint: look into argument defaults here:
|
18
|
-
http://elixir-lang.org/getting-started/modules.html#default-arguments
|
18
|
+
http://elixir-lang.org/getting-started/modules-and-functions.html#default-arguments
|
19
19
|
"""
|
20
20
|
|
21
21
|
@doc """
|
@@ -0,0 +1,119 @@
|
|
1
|
+
defmodule ScaleGenerator do
|
2
|
+
@chromatic_scale ~w(C C# D D# E F F# G G# A A# B)
|
3
|
+
@flat_chromatic_scale ~w(C Db D Eb E F Gb G Ab A Bb B)
|
4
|
+
@flat_keys ~w(F Bb Eb Ab Db Gb d g c f bb eb)
|
5
|
+
|
6
|
+
@doc """
|
7
|
+
Find the note for a given interval (`step`) in a `scale` after the `tonic`.
|
8
|
+
|
9
|
+
"m": one semitone
|
10
|
+
"M": two semitones (full tone)
|
11
|
+
"A": augmented second (three semitones)
|
12
|
+
|
13
|
+
Given the `tonic` "D" in the `scale` (C C# D D# E F F# G G# A A# B C), you
|
14
|
+
should return the following notes for the given `step`:
|
15
|
+
|
16
|
+
"m": D#
|
17
|
+
"M": E
|
18
|
+
"A": F
|
19
|
+
"""
|
20
|
+
@spec step(scale :: list(String.t()), tonic :: String.t(), step :: String.t()) :: list(String.t())
|
21
|
+
def step(scale, tonic, step) do
|
22
|
+
scale |> rotate_chromatic(tonic) |> do_step(step)
|
23
|
+
end
|
24
|
+
|
25
|
+
defp do_step([_tonic, semitone, _full_tone | _], "m"), do: semitone
|
26
|
+
defp do_step([_tonic, _semitone, full_tone | _], "M"), do: full_tone
|
27
|
+
defp do_step([_tonic, _semitone, _full_tone, accidental | _], "A"), do: accidental
|
28
|
+
|
29
|
+
@doc """
|
30
|
+
The chromatic scale is a musical scale with thirteen pitches, each a semitone
|
31
|
+
(half-tone) above or below another.
|
32
|
+
|
33
|
+
Notes with a sharp (#) are a semitone higher than the note below them, where
|
34
|
+
the next letter note is a full tone except in the case of B and E, which have
|
35
|
+
no sharps.
|
36
|
+
|
37
|
+
Generate these notes, starting with the given `tonic` and wrapping back
|
38
|
+
around to the note before it, ending with the tonic an octave higher than the
|
39
|
+
original. If the `tonic` is lowercase, capitalize it.
|
40
|
+
|
41
|
+
"C" should generate: ~w(C C# D D# E F F# G G# A A# B C)
|
42
|
+
"""
|
43
|
+
@spec chromatic_scale(tonic :: String.t()) :: list(String.t())
|
44
|
+
def chromatic_scale(tonic \\ "C") do
|
45
|
+
rotate_chromatic(@chromatic_scale, tonic)
|
46
|
+
end
|
47
|
+
|
48
|
+
@doc """
|
49
|
+
Sharp notes can also be considered the flat (b) note of the tone above them,
|
50
|
+
so the notes can also be represented as:
|
51
|
+
|
52
|
+
A Bb B C Db D Eb E F Gb G Ab
|
53
|
+
|
54
|
+
Generate these notes, starting with the given `tonic` and wrapping back
|
55
|
+
around to the note before it, ending with the tonic an octave higher than the
|
56
|
+
original. If the `tonic` is lowercase, capitalize it.
|
57
|
+
|
58
|
+
"C" should generate: ~w(C Db D Eb E F Gb G Ab A Bb B C)
|
59
|
+
"""
|
60
|
+
@spec flat_chromatic_scale(tonic :: String.t()) :: list(String.t())
|
61
|
+
def flat_chromatic_scale(tonic \\ "C") do
|
62
|
+
rotate_chromatic(@flat_chromatic_scale, tonic)
|
63
|
+
end
|
64
|
+
|
65
|
+
defp rotate_chromatic(scale, tonic) do
|
66
|
+
scale_length = length(scale)
|
67
|
+
|
68
|
+
scale
|
69
|
+
|> Stream.cycle
|
70
|
+
|> Enum.take(2 * scale_length)
|
71
|
+
|> rotate_chromatic(tonic |> String.capitalize, [])
|
72
|
+
|> Enum.take(scale_length + 1)
|
73
|
+
end
|
74
|
+
defp rotate_chromatic([tonic | _] = scale_from_tonic, tonic, results), do: scale_from_tonic ++ results
|
75
|
+
defp rotate_chromatic([head | tail], tonic, results), do: rotate_chromatic(tail, tonic, results ++ [head])
|
76
|
+
|
77
|
+
@doc """
|
78
|
+
Certain scales will require the use of the flat version, depending on the
|
79
|
+
`tonic` (key) that begins them, which is C in the above examples.
|
80
|
+
|
81
|
+
For any of the following tonics, use the flat chromatic scale:
|
82
|
+
|
83
|
+
F Bb Eb Ab Db Gb d g c f bb eb
|
84
|
+
|
85
|
+
For all others, use the regular chromatic scale.
|
86
|
+
"""
|
87
|
+
@spec find_chromatic_scale(tonic :: String.t()) :: list(String.t())
|
88
|
+
for flat_tonic <- @flat_keys do
|
89
|
+
def find_chromatic_scale(unquote(flat_tonic)), do: flat_chromatic_scale(unquote(flat_tonic |> String.capitalize))
|
90
|
+
end
|
91
|
+
def find_chromatic_scale(tonic) do
|
92
|
+
chromatic_scale(tonic)
|
93
|
+
end
|
94
|
+
|
95
|
+
@doc """
|
96
|
+
The `pattern` string will let you know how many steps to make for the next
|
97
|
+
note in the scale.
|
98
|
+
|
99
|
+
For example, a C Major scale will receive the pattern "MMmMMMm", which
|
100
|
+
indicates you will start with C, make a full step over C# to D, another over
|
101
|
+
D# to E, then a semitone, stepping from E to F (again, E has no sharp). You
|
102
|
+
can follow the rest of the pattern to get:
|
103
|
+
|
104
|
+
C D E F G A B C
|
105
|
+
"""
|
106
|
+
@spec scale(tonic :: String.t(), pattern :: String.t()) :: list(String.t())
|
107
|
+
def scale(tonic, pattern) do
|
108
|
+
tonic
|
109
|
+
|> find_chromatic_scale
|
110
|
+
|> generate_scale(pattern, [tonic |> String.capitalize])
|
111
|
+
end
|
112
|
+
|
113
|
+
defp generate_scale(scale, pattern, results)
|
114
|
+
defp generate_scale(_scale, "", results), do: Enum.reverse(results)
|
115
|
+
defp generate_scale(scale, <<step_amt::binary-size(1), pattern::binary>>, [last_tonic | _] = results) do
|
116
|
+
generate_scale(scale, pattern, [step(scale, last_tonic, step_amt) | results])
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
defmodule ScaleGenerator do
|
2
|
+
@doc """
|
3
|
+
Find the note for a given interval (`step`) in a `scale` after the `tonic`.
|
4
|
+
|
5
|
+
"m": one semitone
|
6
|
+
"M": two semitones (full tone)
|
7
|
+
"A": augmented second (three semitones)
|
8
|
+
|
9
|
+
Given the `tonic` "D" in the `scale` (C C# D D# E F F# G G# A A# B C), you
|
10
|
+
should return the following notes for the given `step`:
|
11
|
+
|
12
|
+
"m": D#
|
13
|
+
"M": E
|
14
|
+
"A": F
|
15
|
+
"""
|
16
|
+
@spec step(scale :: list(String.t()), tonic :: String.t(), step :: String.t()) :: list(String.t())
|
17
|
+
def step(scale, tonic, step) do
|
18
|
+
end
|
19
|
+
|
20
|
+
@doc """
|
21
|
+
The chromatic scale is a musical scale with thirteen pitches, each a semitone
|
22
|
+
(half-tone) above or below another.
|
23
|
+
|
24
|
+
Notes with a sharp (#) are a semitone higher than the note below them, where
|
25
|
+
the next letter note is a full tone except in the case of B and E, which have
|
26
|
+
no sharps.
|
27
|
+
|
28
|
+
Generate these notes, starting with the given `tonic` and wrapping back
|
29
|
+
around to the note before it, ending with the tonic an octave higher than the
|
30
|
+
original. If the `tonic` is lowercase, capitalize it.
|
31
|
+
|
32
|
+
"C" should generate: ~w(C C# D D# E F F# G G# A A# B C)
|
33
|
+
"""
|
34
|
+
@spec chromatic_scale(tonic :: String.t()) :: list(String.t())
|
35
|
+
def chromatic_scale(tonic \\ "C") do
|
36
|
+
end
|
37
|
+
|
38
|
+
@doc """
|
39
|
+
Sharp notes can also be considered the flat (b) note of the tone above them,
|
40
|
+
so the notes can also be represented as:
|
41
|
+
|
42
|
+
A Bb B C Db D Eb E F Gb G Ab
|
43
|
+
|
44
|
+
Generate these notes, starting with the given `tonic` and wrapping back
|
45
|
+
around to the note before it, ending with the tonic an octave higher than the
|
46
|
+
original. If the `tonic` is lowercase, capitalize it.
|
47
|
+
|
48
|
+
"C" should generate: ~w(C Db D Eb E F Gb G Ab A Bb B C)
|
49
|
+
"""
|
50
|
+
@spec flat_chromatic_scale(tonic :: String.t()) :: list(String.t())
|
51
|
+
def flat_chromatic_scale(tonic \\ "C") do
|
52
|
+
end
|
53
|
+
|
54
|
+
@doc """
|
55
|
+
Certain scales will require the use of the flat version, depending on the
|
56
|
+
`tonic` (key) that begins them, which is C in the above examples.
|
57
|
+
|
58
|
+
For any of the following tonics, use the flat chromatic scale:
|
59
|
+
|
60
|
+
F Bb Eb Ab Db Gb d g c f bb eb
|
61
|
+
|
62
|
+
For all others, use the regular chromatic scale.
|
63
|
+
"""
|
64
|
+
@spec find_chromatic_scale(tonic :: String.t()) :: list(String.t())
|
65
|
+
def find_chromatic_scale(tonic) do
|
66
|
+
end
|
67
|
+
|
68
|
+
@doc """
|
69
|
+
The `pattern` string will let you know how many steps to make for the next
|
70
|
+
note in the scale.
|
71
|
+
|
72
|
+
For example, a C Major scale will receive the pattern "MMmMMMm", which
|
73
|
+
indicates you will start with C, make a full step over C# to D, another over
|
74
|
+
D# to E, then a semitone, stepping from E to F (again, E has no sharp). You
|
75
|
+
can follow the rest of the pattern to get:
|
76
|
+
|
77
|
+
C D E F G A B C
|
78
|
+
"""
|
79
|
+
@spec scale(tonic :: String.t(), pattern :: String.t()) :: list(String.t())
|
80
|
+
def scale(tonic, pattern) do
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
@@ -0,0 +1,282 @@
|
|
1
|
+
if !System.get_env("EXERCISM_TEST_EXAMPLES") do
|
2
|
+
Code.load_file("scale_generator.exs", __DIR__)
|
3
|
+
end
|
4
|
+
|
5
|
+
ExUnit.start
|
6
|
+
ExUnit.configure trace: true, exclude: :pending
|
7
|
+
|
8
|
+
defmodule ScaleGeneratorTest do
|
9
|
+
use ExUnit.Case
|
10
|
+
|
11
|
+
@major_scale_pattern "MMmMMMm"
|
12
|
+
@minor_scale_pattern "MmMMmMM"
|
13
|
+
@dorian_scale_pattern "MmMMMmM"
|
14
|
+
@mixolydian_scale_pattern "MMmMMmM"
|
15
|
+
@lydian_scale_pattern "MMMmMMm"
|
16
|
+
@phrygian_scale_pattern "mMMMmMM"
|
17
|
+
@locrian_scale_pattern "mMMmMMM"
|
18
|
+
@harmonic_minor_scale_pattern "MmMMmAm"
|
19
|
+
@melodic_minor_scale_pattern "MmMMMMm"
|
20
|
+
@octatonic_scale_pattern "MmMmMmMm"
|
21
|
+
@hexatonic_scale_pattern "MMMMMM"
|
22
|
+
@pentatonic_scale_pattern "MMAMA"
|
23
|
+
@enigmatic_scale_pattern "mAMMMmm"
|
24
|
+
|
25
|
+
describe "step to next note" do
|
26
|
+
#@tag :pending
|
27
|
+
test "with half-tone interval" do
|
28
|
+
assert ScaleGenerator.step(~w(C C# D D# E F F# G G# A A# B), "C", "m") == "C#"
|
29
|
+
end
|
30
|
+
|
31
|
+
@tag :pending
|
32
|
+
test "with full tone interval" do
|
33
|
+
assert ScaleGenerator.step(~w(C C# D D# E F F# G G# A A# B), "C", "M") == "D"
|
34
|
+
end
|
35
|
+
|
36
|
+
@tag :pending
|
37
|
+
test "with accidental interval" do
|
38
|
+
assert ScaleGenerator.step(~w(C C# D D# E F F# G G# A A# B), "C", "A") == "D#"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "generate chromatic scale" do
|
43
|
+
@tag :pending
|
44
|
+
test "starting with A" do
|
45
|
+
assert ScaleGenerator.chromatic_scale("A") == ~w(A A# B C C# D D# E F F# G G# A)
|
46
|
+
end
|
47
|
+
|
48
|
+
@tag :pending
|
49
|
+
test "starting with C" do
|
50
|
+
assert ScaleGenerator.chromatic_scale("C") == ~w(C C# D D# E F F# G G# A A# B C)
|
51
|
+
end
|
52
|
+
|
53
|
+
@tag :pending
|
54
|
+
test "starting with G" do
|
55
|
+
assert ScaleGenerator.chromatic_scale("G") == ~w(G G# A A# B C C# D D# E F F# G)
|
56
|
+
end
|
57
|
+
|
58
|
+
@tag :pending
|
59
|
+
test "works with with lowercase notes" do
|
60
|
+
assert ScaleGenerator.chromatic_scale("f#") == ~w(F# G G# A A# B C C# D D# E F F#)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "generate flat chromatic scale" do
|
65
|
+
@tag :pending
|
66
|
+
test "starting with A" do
|
67
|
+
assert ScaleGenerator.flat_chromatic_scale("A") == ~w(A Bb B C Db D Eb E F Gb G Ab A)
|
68
|
+
end
|
69
|
+
|
70
|
+
@tag :pending
|
71
|
+
test "starting with C" do
|
72
|
+
assert ScaleGenerator.flat_chromatic_scale("C") == ~w(C Db D Eb E F Gb G Ab A Bb B C)
|
73
|
+
end
|
74
|
+
|
75
|
+
@tag :pending
|
76
|
+
test "starting with G" do
|
77
|
+
assert ScaleGenerator.flat_chromatic_scale("G") == ~w(G Ab A Bb B C Db D Eb E F Gb G)
|
78
|
+
end
|
79
|
+
|
80
|
+
@tag :pending
|
81
|
+
test "works with with lowercase notes" do
|
82
|
+
assert ScaleGenerator.flat_chromatic_scale("Gb") == ~w(Gb G Ab A Bb B C Db D Eb E F Gb)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "find chromatic scale for flat tonics" do
|
87
|
+
@tag :pending
|
88
|
+
test "using F" do
|
89
|
+
assert ScaleGenerator.find_chromatic_scale("F") == ~w(F Gb G Ab A Bb B C Db D Eb E F)
|
90
|
+
end
|
91
|
+
|
92
|
+
@tag :pending
|
93
|
+
test "using Bb" do
|
94
|
+
assert ScaleGenerator.find_chromatic_scale("Bb") == ~w(Bb B C Db D Eb E F Gb G Ab A Bb)
|
95
|
+
end
|
96
|
+
|
97
|
+
@tag :pending
|
98
|
+
test "using Eb" do
|
99
|
+
assert ScaleGenerator.find_chromatic_scale("Eb") == ~w(Eb E F Gb G Ab A Bb B C Db D Eb)
|
100
|
+
end
|
101
|
+
|
102
|
+
@tag :pending
|
103
|
+
test "using Ab" do
|
104
|
+
assert ScaleGenerator.find_chromatic_scale("Ab") == ~w(Ab A Bb B C Db D Eb E F Gb G Ab)
|
105
|
+
end
|
106
|
+
|
107
|
+
@tag :pending
|
108
|
+
test "using Db" do
|
109
|
+
assert ScaleGenerator.find_chromatic_scale("Db") == ~w(Db D Eb E F Gb G Ab A Bb B C Db)
|
110
|
+
end
|
111
|
+
|
112
|
+
@tag :pending
|
113
|
+
test "using Gb" do
|
114
|
+
assert ScaleGenerator.find_chromatic_scale("Gb") == ~w(Gb G Ab A Bb B C Db D Eb E F Gb)
|
115
|
+
end
|
116
|
+
|
117
|
+
@tag :pending
|
118
|
+
test "using d" do
|
119
|
+
assert ScaleGenerator.find_chromatic_scale("d") == ~w(D Eb E F Gb G Ab A Bb B C Db D)
|
120
|
+
end
|
121
|
+
|
122
|
+
@tag :pending
|
123
|
+
test "using g" do
|
124
|
+
assert ScaleGenerator.find_chromatic_scale("g") == ~w(G Ab A Bb B C Db D Eb E F Gb G)
|
125
|
+
end
|
126
|
+
|
127
|
+
@tag :pending
|
128
|
+
test "using c" do
|
129
|
+
assert ScaleGenerator.find_chromatic_scale("c") == ~w(C Db D Eb E F Gb G Ab A Bb B C)
|
130
|
+
end
|
131
|
+
|
132
|
+
@tag :pending
|
133
|
+
test "using f" do
|
134
|
+
assert ScaleGenerator.find_chromatic_scale("f") == ~w(F Gb G Ab A Bb B C Db D Eb E F)
|
135
|
+
end
|
136
|
+
|
137
|
+
@tag :pending
|
138
|
+
test "using bb" do
|
139
|
+
assert ScaleGenerator.find_chromatic_scale("bb") == ~w(Bb B C Db D Eb E F Gb G Ab A Bb)
|
140
|
+
end
|
141
|
+
|
142
|
+
@tag :pending
|
143
|
+
test "using eb" do
|
144
|
+
assert ScaleGenerator.find_chromatic_scale("eb") == ~w(Eb E F Gb G Ab A Bb B C Db D Eb)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe "find chromatic scale for non-flat tonics" do
|
149
|
+
@tag :pending
|
150
|
+
test "using A" do
|
151
|
+
assert ScaleGenerator.find_chromatic_scale("A") == ~w(A A# B C C# D D# E F F# G G# A)
|
152
|
+
end
|
153
|
+
|
154
|
+
@tag :pending
|
155
|
+
test "using A#" do
|
156
|
+
assert ScaleGenerator.find_chromatic_scale("A#") == ~w(A# B C C# D D# E F F# G G# A A#)
|
157
|
+
end
|
158
|
+
|
159
|
+
@tag :pending
|
160
|
+
test "using B" do
|
161
|
+
assert ScaleGenerator.find_chromatic_scale("B") == ~w(B C C# D D# E F F# G G# A A# B)
|
162
|
+
end
|
163
|
+
|
164
|
+
@tag :pending
|
165
|
+
test "using C" do
|
166
|
+
assert ScaleGenerator.find_chromatic_scale("C") == ~w(C C# D D# E F F# G G# A A# B C)
|
167
|
+
end
|
168
|
+
|
169
|
+
@tag :pending
|
170
|
+
test "using C#" do
|
171
|
+
assert ScaleGenerator.find_chromatic_scale("C#") == ~w(C# D D# E F F# G G# A A# B C C#)
|
172
|
+
end
|
173
|
+
|
174
|
+
@tag :pending
|
175
|
+
test "using D" do
|
176
|
+
assert ScaleGenerator.find_chromatic_scale("D") == ~w(D D# E F F# G G# A A# B C C# D)
|
177
|
+
end
|
178
|
+
|
179
|
+
@tag :pending
|
180
|
+
test "using D#" do
|
181
|
+
assert ScaleGenerator.find_chromatic_scale("D#") == ~w(D# E F F# G G# A A# B C C# D D#)
|
182
|
+
end
|
183
|
+
|
184
|
+
@tag :pending
|
185
|
+
test "using E" do
|
186
|
+
assert ScaleGenerator.find_chromatic_scale("E") == ~w(E F F# G G# A A# B C C# D D# E)
|
187
|
+
end
|
188
|
+
|
189
|
+
@tag :pending
|
190
|
+
test "using F#" do
|
191
|
+
assert ScaleGenerator.find_chromatic_scale("F#") == ~w(F# G G# A A# B C C# D D# E F F#)
|
192
|
+
end
|
193
|
+
|
194
|
+
@tag :pending
|
195
|
+
test "using G" do
|
196
|
+
assert ScaleGenerator.find_chromatic_scale("G") == ~w(G G# A A# B C C# D D# E F F# G)
|
197
|
+
end
|
198
|
+
|
199
|
+
@tag :pending
|
200
|
+
test "using G#" do
|
201
|
+
assert ScaleGenerator.find_chromatic_scale("G#") == ~w(G# A A# B C C# D D# E F F# G G#)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
describe "generate scale from tonic and pattern" do
|
206
|
+
@tag :pending
|
207
|
+
test "C Major scale" do
|
208
|
+
assert ScaleGenerator.scale("C", @major_scale_pattern) == ~w(C D E F G A B C)
|
209
|
+
end
|
210
|
+
|
211
|
+
@tag :pending
|
212
|
+
test "G Major scale" do
|
213
|
+
assert ScaleGenerator.scale("G", @major_scale_pattern) == ~w(G A B C D E F# G)
|
214
|
+
end
|
215
|
+
|
216
|
+
@tag :pending
|
217
|
+
test "f# minor scale" do
|
218
|
+
assert ScaleGenerator.scale("f#", @minor_scale_pattern) == ~w(F# G# A B C# D E F#)
|
219
|
+
end
|
220
|
+
|
221
|
+
@tag :pending
|
222
|
+
test "b flat minor scale" do
|
223
|
+
assert ScaleGenerator.scale("bb", @minor_scale_pattern) == ~w(Bb C Db Eb F Gb Ab Bb)
|
224
|
+
end
|
225
|
+
|
226
|
+
@tag :pending
|
227
|
+
test "D Dorian scale" do
|
228
|
+
assert ScaleGenerator.scale("d", @dorian_scale_pattern) == ~w(D E F G A B C D)
|
229
|
+
end
|
230
|
+
|
231
|
+
@tag :pending
|
232
|
+
test "E flat Mixolydian scale" do
|
233
|
+
assert ScaleGenerator.scale("Eb", @mixolydian_scale_pattern) == ~w(Eb F G Ab Bb C Db Eb)
|
234
|
+
end
|
235
|
+
|
236
|
+
@tag :pending
|
237
|
+
test "a Lydian scale" do
|
238
|
+
assert ScaleGenerator.scale("a", @lydian_scale_pattern) == ~w(A B C# D# E F# G# A)
|
239
|
+
end
|
240
|
+
|
241
|
+
@tag :pending
|
242
|
+
test "e Phrygian scale" do
|
243
|
+
assert ScaleGenerator.scale("e", @phrygian_scale_pattern) == ~w(E F G A B C D E)
|
244
|
+
end
|
245
|
+
|
246
|
+
@tag :pending
|
247
|
+
test "g Locrian scale" do
|
248
|
+
assert ScaleGenerator.scale("g", @locrian_scale_pattern) == ~w(G Ab Bb C Db Eb F G)
|
249
|
+
end
|
250
|
+
|
251
|
+
@tag :pending
|
252
|
+
test "d Harmonic minor scale" do
|
253
|
+
assert ScaleGenerator.scale("d", @harmonic_minor_scale_pattern) == ~w(D E F G A Bb Db D)
|
254
|
+
end
|
255
|
+
|
256
|
+
@tag :pending
|
257
|
+
test "C Melodic minor scale" do
|
258
|
+
assert ScaleGenerator.scale("C", @melodic_minor_scale_pattern) == ~w(C D D# F G A B C)
|
259
|
+
end
|
260
|
+
|
261
|
+
@tag :pending
|
262
|
+
test "C Octatonic scale" do
|
263
|
+
assert ScaleGenerator.scale("C", @octatonic_scale_pattern) == ~w(C D D# F F# G# A B C)
|
264
|
+
end
|
265
|
+
|
266
|
+
@tag :pending
|
267
|
+
test "D flat Hexatonic scale" do
|
268
|
+
assert ScaleGenerator.scale("Db", @hexatonic_scale_pattern) == ~w(Db Eb F G A B Db)
|
269
|
+
end
|
270
|
+
|
271
|
+
@tag :pending
|
272
|
+
test "A Pentatonic scale" do
|
273
|
+
assert ScaleGenerator.scale("A", @pentatonic_scale_pattern) == ~w(A B C# E F# A)
|
274
|
+
end
|
275
|
+
|
276
|
+
@tag :pending
|
277
|
+
test "G Enigmatic scale" do
|
278
|
+
assert ScaleGenerator.scale("G", @enigmatic_scale_pattern) == ~w(G G# B C# D# F F# G)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|