1
exercism fetch ruby scale-generator

scale_generator_test.rb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
require 'minitest/autorun'
require_relative 'scale_generator'

class ScaleGeneratorTest < Minitest::Test
  def test_naming_scale
    chromatic = Scale.new('c', :chromatic)
    expected = 'C chromatic'
    actual = chromatic.name
    assert_equal expected, actual
  end

  def test_chromatic_scale
    skip
    chromatic = Scale.new('C', :chromatic)
    expected = %w(C C# D D# E F F# G G# A A# B)
    actual = chromatic.pitches
    assert_equal expected, actual
  end

  def test_another_chromatic_scale
    skip
    chromatic = Scale.new('F', :chromatic)
    expected = %w(F Gb G Ab A Bb B C Db D Eb E)
    actual = chromatic.pitches
    assert_equal expected, actual
  end

  def test_naming_major_scale
    skip
    major = Scale.new('G', :major, 'MMmMMMm')
    expected = 'G major'
    actual = major.name
    assert_equal expected, actual
  end

  def test_major_scale
    skip
    major = Scale.new('C', :major, 'MMmMMMm')
    expected = %w(C D E F G A B)
    actual = major.pitches
    assert_equal expected, actual
  end

  def test_another_major_scale
    skip
    major = Scale.new('G', :major, 'MMmMMMm')
    expected = %w(G A B C D E F#)
    actual = major.pitches
    assert_equal expected, actual
  end

  def test_minor_scale
    skip
    minor = Scale.new('f#', :minor, 'MmMMmMM')
    expected = %w(F# G# A B C# D E)
    actual = minor.pitches
    assert_equal expected, actual
  end

  def test_another_minor_scale
    skip
    minor = Scale.new('bb', :minor, 'MmMMmMM')
    expected = %w(Bb C Db Eb F Gb Ab)
    actual = minor.pitches
    assert_equal expected, actual
  end

  def test_dorian_mode
    skip
    dorian = Scale.new('d', :dorian, 'MmMMMmM')
    expected = %w(D E F G A B C)
    actual = dorian.pitches
    assert_equal expected, actual
  end

  def test_mixolydian_mode
    skip
    mixolydian = Scale.new('Eb', :mixolydian, 'MMmMMmM')
    expected = %w(Eb F G Ab Bb C Db)
    actual = mixolydian.pitches
    assert_equal expected, actual
  end

  def test_lydian_mode
    skip
    lydian = Scale.new('a', :lydian, 'MMMmMMm')
    expected = %w(A B C# D# E F# G#)
    actual = lydian.pitches
    assert_equal expected, actual
  end

  def test_phrygian_mode
    skip
    phrygian = Scale.new('e', :phrygian, 'mMMMmMM')
    expected = %w(E F G A B C D)
    actual = phrygian.pitches
    assert_equal expected, actual
  end

  def test_locrian_mode
    skip
    locrian = Scale.new('g', :locrian, 'mMMmMMM')
    expected = %w(G Ab Bb C Db Eb F)
    actual = locrian.pitches
    assert_equal expected, actual
  end

  def test_harmonic_minor
    skip
    harmonic_minor = Scale.new('d', :harmonic_minor, 'MmMMmAm')
    expected = %w(D E F G A Bb Db)
    actual = harmonic_minor.pitches
    assert_equal expected, actual
  end

  def test_octatonic
    skip
    octatonic = Scale.new('C', :octatonic, 'MmMmMmMm')
    expected = %w(C D D# F F# G# A B)
    actual = octatonic.pitches
    assert_equal expected, actual
  end

  def test_hexatonic
    skip
    hexatonic = Scale.new('Db', :hexatonic, 'MMMMMM')
    expected = %w(Db Eb F G A B)
    actual = hexatonic.pitches
    assert_equal expected, actual
  end

  def test_pentatonic
    skip
    pentatonic = Scale.new('A', :pentatonic, 'MMAMA')
    expected = %w(A B C# E F#)
    actual = pentatonic.pitches
    assert_equal expected, actual
  end

  def test_enigmatic
    skip
    enigmatic = Scale.new('G', :enigma, 'mAMMMmM')
    expected = %w(G G# B C# D# F F#)
    actual = enigmatic.pitches
    assert_equal expected, actual
  end

  # Problems in exercism evolve over time, as we find better ways to ask
  # questions.
  # The version number refers to the version of the problem you solved,
  # not your solution.
  #
  # Define a constant named VERSION inside of the top level BookKeeping
  # module, which may be placed near the end of your file.
  #
  # In your file, it will look like this:
  #
  # module BookKeeping
  #   VERSION = 1 # Where the version number matches the one in the test.
  # end
  #
  # If you are curious, read more about constants on RubyDoc:
  # http://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html

  def test_bookkeeping
    skip
    assert_equal 1, BookKeeping::VERSION
  end
end