beats 1.2.4 → 1.2.5

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.
@@ -21,7 +21,7 @@ class CachingWriterTest < Test::Unit::TestCase
21
21
  buffer = WaveFile::Buffer.new([0, 1, 2], format)
22
22
  writer.write(buffer)
23
23
  assert_equal(buffer1_bytes, get_bytes(string_io))
24
-
24
+
25
25
  buffer = WaveFile::Buffer.new([3, 4, 5], format)
26
26
  writer.write(buffer)
27
27
  assert_equal(buffer1_bytes + buffer2_bytes, get_bytes(string_io))
@@ -0,0 +1,18 @@
1
+ Song:
2
+ Tempo: 120
3
+ Flow:
4
+ - Verse: x1
5
+ - Chorus: x2
6
+ Kit:
7
+ - bass: test/sounds/agogo_high_stereo_16.wav
8
+ - bass2: test/sounds/snare_stereo_16.wav
9
+
10
+ Verse:
11
+ - bass: X...X...X...X...
12
+ - bass: ..X...X...X...X.
13
+ - bass2: X.X.X.X.X.X.X.X.
14
+
15
+
16
+ Chorus:
17
+ - bass: X...X...
18
+ - bass2: X.X.X.X.
@@ -1,22 +1,15 @@
1
1
  # Standard Ruby libraries
2
2
  require 'test/unit'
3
3
  require 'yaml'
4
+ require 'syck'
4
5
  require 'rubygems'
5
6
 
6
7
  # External gems
7
- gem 'wavefile', "=0.4.0"
8
8
  require 'wavefile'
9
9
 
10
10
  # BEATS classes
11
- require 'audioengine'
12
- require 'audioutils'
13
11
  require 'beats'
14
12
  require 'wavefile/cachingwriter'
15
- require 'kit'
16
- require 'pattern'
17
- require 'song'
18
- require 'songparser'
19
- require 'songoptimizer'
20
- require 'track'
13
+ include Beats
21
14
 
22
15
  YAML::ENGINE.yamler = 'syck' if defined?(YAML::ENGINE)
@@ -3,7 +3,7 @@ require 'includes'
3
3
  class IntegrationTest < Test::Unit::TestCase
4
4
  TRACK_NAMES = ["bass", "snare", "hh_closed", "hh_closed2", "agogo", "tom4", "tom2"]
5
5
  OUTPUT_FOLDER = "test/integration_output"
6
-
6
+
7
7
  def setup
8
8
  # Make sure no output from previous tests is still around
9
9
  clean_output_folder()
@@ -17,19 +17,19 @@ class IntegrationTest < Test::Unit::TestCase
17
17
  "no_flow.txt",
18
18
  "sound_in_kit_not_found.txt",
19
19
  "sound_in_track_not_found.txt"]
20
-
20
+
21
21
  invalid_fixtures.each do |fixture_name|
22
22
  assert_raise(SongParseError) do
23
- beats = Beats.new("test/fixtures/invalid/#{fixture_name}", "doesn't matter", {:split => false})
23
+ beats = BeatsRunner.new("test/fixtures/invalid/#{fixture_name}", "doesn't matter", {:split => false})
24
24
  beats.run()
25
25
  end
26
26
  end
27
27
  end
28
-
29
-
28
+
29
+
30
30
  # TODO: Add tests for the -p option
31
31
  # TODO: Add test verify that song generated with and without SongOptimizer are identical.
32
-
32
+
33
33
  def test_base_path
34
34
  run_combined_test("mono", 16, "_base_path", "test/sounds")
35
35
  run_split_test("mono", 16, "_base_path", "test/sounds")
@@ -41,21 +41,21 @@ class IntegrationTest < Test::Unit::TestCase
41
41
  run_combined_test("stereo", 8)
42
42
  run_combined_test("stereo", 16)
43
43
  end
44
-
44
+
45
45
  def run_combined_test(num_channels, bits_per_sample, suffix="", base_path=nil)
46
46
  # Make sure no output from previous tests is still around
47
47
  assert_directory_is_empty OUTPUT_FOLDER
48
-
48
+
49
49
  song_fixture = "test/fixtures/valid/example_#{num_channels}_#{bits_per_sample}#{suffix}.txt"
50
50
  actual_output_file = "#{OUTPUT_FOLDER}/example_combined_#{num_channels}_#{bits_per_sample}#{suffix}.wav"
51
51
  expected_output_file = "test/fixtures/expected_output/example_combined_#{num_channels}_#{bits_per_sample}.wav"
52
-
52
+
53
53
  options = {:split => false}
54
54
  unless base_path == nil
55
55
  options[:base_path] = base_path
56
56
  end
57
57
 
58
- beats = Beats.new(song_fixture, actual_output_file, options)
58
+ beats = BeatsRunner.new(song_fixture, actual_output_file, options)
59
59
  beats.run()
60
60
  assert(File.exists?(actual_output_file), "Expected file '#{actual_output_file}' to exist, but it doesn't.")
61
61
 
@@ -63,32 +63,32 @@ class IntegrationTest < Test::Unit::TestCase
63
63
  expected_output_file_contents = File.open(expected_output_file, "rb") {|f| f.read() }
64
64
  actual_output_file_contents = File.open(actual_output_file, "rb") {|f| f.read() }
65
65
  assert_equal(expected_output_file_contents, actual_output_file_contents)
66
-
66
+
67
67
  # Clean up after ourselves
68
68
  File.delete(actual_output_file)
69
69
  end
70
-
70
+
71
71
  def test_generate_split
72
72
  run_split_test("mono", 8)
73
73
  run_split_test("mono", 16)
74
74
  run_split_test("stereo", 8)
75
75
  run_split_test("stereo", 16)
76
76
  end
77
-
77
+
78
78
  def run_split_test(num_channels, bits_per_sample, suffix="", base_path=nil)
79
79
  # Make sure no output from previous tests is still around
80
80
  assert_directory_is_empty OUTPUT_FOLDER
81
-
81
+
82
82
  song_fixture = "test/fixtures/valid/example_#{num_channels}_#{bits_per_sample}#{suffix}.txt"
83
83
  actual_output_prefix = "#{OUTPUT_FOLDER}/example_split_#{num_channels}_#{bits_per_sample}#{suffix}"
84
84
  expected_output_prefix = "test/fixtures/expected_output/example_split_#{num_channels}_#{bits_per_sample}"
85
-
85
+
86
86
  options = {:split => true}
87
87
  unless base_path == nil
88
88
  options[:base_path] = base_path
89
89
  end
90
90
 
91
- beats = Beats.new(song_fixture, actual_output_prefix + ".wav", options)
91
+ beats = BeatsRunner.new(song_fixture, actual_output_prefix + ".wav", options)
92
92
  beats.run()
93
93
  TRACK_NAMES.each do |track_name|
94
94
  if(track_name.start_with?("tom"))
@@ -97,12 +97,12 @@ class IntegrationTest < Test::Unit::TestCase
97
97
  actual_output_file = "#{actual_output_prefix}-#{track_name}.wav"
98
98
  expected_output_file = "#{expected_output_prefix}-#{track_name}.wav"
99
99
  assert(File.exists?(actual_output_file), "Expected file '#{actual_output_file}' to exist, but it doesn't.")
100
-
100
+
101
101
  # Reading the files this way instead of a plain File.read() for Windows compatibility with binary files
102
102
  expected_output_file_contents = File.open(expected_output_file, "rb") {|f| f.read() }
103
103
  actual_output_file_contents = File.open(actual_output_file, "rb") {|f| f.read() }
104
104
  assert_equal(expected_output_file_contents, actual_output_file_contents)
105
-
105
+
106
106
  # Clean up after ourselves
107
107
  File.delete(actual_output_file)
108
108
  end
@@ -111,11 +111,11 @@ class IntegrationTest < Test::Unit::TestCase
111
111
  def assert_directory_is_empty dir
112
112
  assert_equal([".", ".."].sort, Dir.new(dir).entries.sort)
113
113
  end
114
-
114
+
115
115
  def clean_output_folder()
116
116
  # Make the folder if it doesn't already exist
117
117
  Dir.mkdir(OUTPUT_FOLDER) unless File.exists?(OUTPUT_FOLDER)
118
-
118
+
119
119
  dir = Dir.new(OUTPUT_FOLDER)
120
120
  file_names = dir.entries
121
121
  file_names.each do |file_name|
@@ -9,10 +9,10 @@ end
9
9
  class KitTest < Test::Unit::TestCase
10
10
  MIN_SAMPLE_8BIT = 0
11
11
  MAX_SAMPLE_8BIT = 255
12
-
12
+
13
13
  def generate_test_data
14
14
  kits = {}
15
-
15
+
16
16
  # Kit with no sounds
17
17
  kits[:empty] = Kit.new("test/sounds", {})
18
18
 
@@ -25,7 +25,7 @@ class KitTest < Test::Unit::TestCase
25
25
  kits[:stereo16] = Kit.new("test/sounds", {"mono8" => "bass_mono_8.wav",
26
26
  "mono16" => "bass_mono_16.wav",
27
27
  "stereo16" => "bass_stereo_16.wav"})
28
-
28
+
29
29
  # Kits which contain a composite sound
30
30
  #kits[:basic_composite] = Kit.new("test/sounds", {"mono8" => "bass_mono_8.wav",
31
31
  # "composite_mono8" => ["snare_mono_8.wav", "tom3_mono_8.wav"]})
@@ -35,68 +35,68 @@ class KitTest < Test::Unit::TestCase
35
35
  # "composite_stereo16" => ["snare_stereo_16.wav", "tom3_mono_16.wav"]})
36
36
  #kits[:mismatched_everything_composite] = Kit.new("test/sounds", {"mono8" => "bass_mono_8.wav",
37
37
  # "composite_stereo16" => ["snare_stereo_8.wav", "tom3_mono_16.wav"]})
38
-
39
- return kits
38
+
39
+ kits
40
40
  end
41
-
41
+
42
42
  def test_valid_initialization
43
43
  kits = generate_test_data()
44
-
44
+
45
45
  assert_equal(16, kits[:empty].bits_per_sample)
46
46
  assert_equal(1, kits[:empty].num_channels)
47
-
47
+
48
48
  assert_equal(16, kits[:mono8].bits_per_sample)
49
49
  assert_equal(1, kits[:mono8].num_channels)
50
-
50
+
51
51
  assert_equal(16, kits[:mono16].bits_per_sample)
52
52
  assert_equal(1, kits[:mono16].num_channels)
53
-
53
+
54
54
  assert_equal(16, kits[:stereo8].bits_per_sample)
55
55
  assert_equal(2, kits[:stereo8].num_channels)
56
-
56
+
57
57
  assert_equal(16, kits[:stereo16].bits_per_sample)
58
58
  assert_equal(2, kits[:stereo16].num_channels)
59
-
59
+
60
60
  #assert_equal(16, kits[:basic_composite].bits_per_sample)
61
61
  #assert_equal(1, kits[:basic_composite].num_channels)
62
-
62
+
63
63
  #assert_equal(16, kits[:mismatched_bps_composite].bits_per_sample)
64
64
  #assert_equal(1, kits[:mismatched_bps_composite].num_channels)
65
-
65
+
66
66
  #assert_equal(16, kits[:mismatched_channels_composite].bits_per_sample)
67
67
  #assert_equal(2, kits[:mismatched_channels_composite].num_channels)
68
-
68
+
69
69
  #assert_equal(16, kits[:mismatched_everything_composite].bits_per_sample)
70
70
  #assert_equal(2, kits[:mismatched_everything_composite].num_channels)
71
71
  end
72
-
72
+
73
73
  def test_invalid_initialization
74
74
  # Tests for adding non-existant sound file to Kit
75
75
  assert_raise(SoundFileNotFoundError) { Kit.new("test/sounds", {"i_do_not_exist" => "i_do_not_exist.wav"}) }
76
-
76
+
77
77
  assert_raise(SoundFileNotFoundError) { Kit.new("test/sounds", {"mono16" => "bass_mono_16.wav",
78
78
  "i_do_not_exist" => "i_do_not_exist.wav"}) }
79
-
79
+
80
80
  #assert_raise(SoundFileNotFoundError) { Kit.new("test/sounds", {"mono16" => "bass_mono_16.wav",
81
81
  # "composite" => ["bass_mono_16.wav", "snare_mono_16.wav"],
82
82
  # "i_do_not_exist" => "i_do_not_exist.wav"}) }
83
-
83
+
84
84
  # Tests for adding invalid sound files to Kit
85
85
  assert_raise(InvalidSoundFormatError) { Kit.new("test", {"bad" => "kit_test.rb"}) }
86
-
86
+
87
87
  assert_raise(InvalidSoundFormatError) { Kit.new("test", {"mono16" => "sounds/bass_mono_16.wav",
88
88
  "bad" => "kit_test.rb"}) }
89
-
89
+
90
90
  #assert_raise(InvalidSoundFormatError) { Kit.new("test", {"mono16" => "sounds/bass_mono_16.wav",
91
91
  # "composite" => ["sounds/bass_mono_16.wav", "sounds/snare_mono_16.wav"],
92
92
  # "bad" => "kit_test.rb"}) }
93
93
  end
94
-
94
+
95
95
  def test_get_sample_data
96
96
  kits = generate_test_data()
97
97
  # Should get an error when trying to get a non-existent sound
98
98
  assert_raise(StandardError) { kits[:mono8].get_sample_data("nonexistant") }
99
-
99
+
100
100
  [:mono8, :mono16].each do |kit_name|
101
101
  sample_data = kits[kit_name].get_sample_data("mono8")
102
102
  # Assert sample data is 16-bit. If max and min samples are outside 0-255 bounds, then it is.
@@ -105,7 +105,7 @@ class KitTest < Test::Unit::TestCase
105
105
  # Assert it has 1 channel. This is true if every item is a Fixnum.
106
106
  assert_equal([], sample_data.select {|sample| sample.class != Fixnum})
107
107
  end
108
-
108
+
109
109
  [:stereo8, :stereo16].each do |kit_name|
110
110
  sample_data = kits[kit_name].get_sample_data("mono8")
111
111
  # Assert sample data is 16-bit. If max and min samples are outside 0-255 bounds, then it is.
@@ -114,19 +114,19 @@ class KitTest < Test::Unit::TestCase
114
114
  # Assert it has 2 channels. This is true if every item is an Array.
115
115
  assert_equal([], sample_data.select {|sample| sample.class != Array})
116
116
  end
117
-
117
+
118
118
  #actual_sample_data = kits[:basic_composite].get_sample_data("composite_mono8")
119
119
  #expected_sample_data = WaveFile.open("test/sounds/composite_snare_mono_8_tom3_mono_8_mono_16.wav").sample_data
120
120
  #assert_equal(expected_sample_data, actual_sample_data)
121
-
121
+
122
122
  #actual_sample_data = kits[:mismatched_bps_composite].get_sample_data("composite_mono16")
123
123
  #expected_sample_data = WaveFile.open("test/sounds/composite_snare_mono_8_tom3_mono_16_mono_16.wav").sample_data
124
124
  #assert_equal(expected_sample_data, actual_sample_data)
125
-
125
+
126
126
  #actual_sample_data = kits[:mismatched_channels_composite].get_sample_data("composite_stereo16")
127
127
  #expected_sample_data = WaveFile.open("test/sounds/composite_snare_stereo_16_tom3_mono_16_stereo_16.wav").sample_data
128
128
  #assert_equal(expected_sample_data, actual_sample_data)
129
-
129
+
130
130
  #actual_sample_data = kits[:mismatched_everything_composite].get_sample_data("composite_stereo16")
131
131
  #expected_sample_data = WaveFile.open("test/sounds/composite_snare_stereo_8_tom3_mono_16_stereo_16.wav").sample_data
132
132
  #assert_equal(expected_sample_data[0..10], actual_sample_data[0..10])
@@ -6,29 +6,29 @@ class PatternTest < Test::Unit::TestCase
6
6
 
7
7
  def generate_test_data
8
8
  test_patterns = {}
9
-
9
+
10
10
  pattern = Pattern.new :blank
11
11
  test_patterns[:blank] = pattern
12
-
12
+
13
13
  pattern = Pattern.new :verse
14
14
  pattern.track "bass.wav", "X...X...X...XX..X...X...XX..X..."
15
15
  pattern.track "snare.wav", "..X...X...X...X.X...X...X...X..."
16
16
  pattern.track "hh_closed.wav", "X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X."
17
17
  pattern.track "hh_open.wav", "X...............X..............X"
18
18
  test_patterns[:verse] = pattern
19
-
19
+
20
20
  pattern = Pattern.new :staircase
21
21
  pattern.track "bass.wav", "X..."
22
22
  pattern.track "snare.wav", "X.."
23
23
  pattern.track "hh_closed.wav", "X."
24
24
  test_patterns[:staircase] = pattern
25
-
26
- return test_patterns
25
+
26
+ test_patterns
27
27
  end
28
-
28
+
29
29
  def test_initialize
30
30
  test_patterns = generate_test_data()
31
-
31
+
32
32
  pattern = test_patterns[:blank]
33
33
  assert_equal(pattern.name, :blank)
34
34
  assert_equal(pattern.tracks.length, 0)
@@ -44,7 +44,7 @@ class PatternTest < Test::Unit::TestCase
44
44
 
45
45
  def test_step_count
46
46
  test_patterns = generate_test_data()
47
-
47
+
48
48
  assert_equal(0, test_patterns[:blank].step_count())
49
49
  assert_equal(32, test_patterns[:verse].step_count())
50
50
  assert_equal(4, test_patterns[:staircase].step_count())
@@ -55,14 +55,14 @@ class PatternTest < Test::Unit::TestCase
55
55
  left_pattern.track("bass", "X...X...")
56
56
  left_pattern.track("snare", "..X...X.")
57
57
  left_pattern.track("hh_closed", "X.X.X.X.")
58
-
58
+
59
59
  right_pattern = Pattern.new("right")
60
60
  right_pattern.track("bass", "X...X...")
61
61
  right_pattern.track("snare", "..X...X.")
62
62
  right_pattern.track("hh_closed", "X.X.X.X.")
63
63
  assert(left_pattern.same_tracks_as?(right_pattern))
64
64
  assert(right_pattern.same_tracks_as?(left_pattern))
65
-
65
+
66
66
  # Now switch up the order. Left and right should still be equal.
67
67
  right_pattern = Pattern.new("right")
68
68
  right_pattern.track("snare", "..X...X.")
@@ -70,7 +70,7 @@ class PatternTest < Test::Unit::TestCase
70
70
  right_pattern.track("bass", "X...X...")
71
71
  assert(left_pattern.same_tracks_as?(right_pattern))
72
72
  assert(right_pattern.same_tracks_as?(left_pattern))
73
-
73
+
74
74
  # Now compare the pattern with same rhythms but different track names. Should not be equal.
75
75
  different_names_pattern = Pattern.new("different_names")
76
76
  different_names_pattern.track("tom", "X...X...")
@@ -78,7 +78,7 @@ class PatternTest < Test::Unit::TestCase
78
78
  different_names_pattern.track("hh_open", "X.X.X.X.")
79
79
  assert_equal(false, left_pattern.same_tracks_as?(different_names_pattern))
80
80
  assert_equal(false, different_names_pattern.same_tracks_as?(left_pattern))
81
-
81
+
82
82
  # Now compare the pattern with same track names but different rhythms. Should not be equal.
83
83
  different_beats_pattern = Pattern.new("different_beats")
84
84
  different_beats_pattern.track("bass", "X...X...")
@@ -86,7 +86,7 @@ class PatternTest < Test::Unit::TestCase
86
86
  different_beats_pattern.track("hh_closed", "X.XXX.X.")
87
87
  assert_equal(false, left_pattern.same_tracks_as?(different_beats_pattern))
88
88
  assert_equal(false, different_beats_pattern.same_tracks_as?(left_pattern))
89
-
89
+
90
90
  # Now compare a pattern with the same tracks, but with one extra one as well. Should not be equal.
91
91
  something_extra = Pattern.new("something_extra")
92
92
  something_extra.track("bass", "X...X...")
@@ -11,13 +11,13 @@ class SongTest < Test::Unit::TestCase
11
11
  base_path = File.dirname(__FILE__) + "/.."
12
12
 
13
13
  test_songs[:blank] = Song.new()
14
-
14
+
15
15
  test_songs[:no_flow] = Song.new()
16
16
  verse = test_songs[:no_flow].pattern :verse
17
17
  verse.track "bass.wav", "X.......X......."
18
18
  verse.track "snare.wav", "....X.......X..."
19
19
  verse.track "hh_closed.wav", "X.X.X.X.X.X.X.X."
20
-
20
+
21
21
  song_parser = SongParser.new()
22
22
  FIXTURES.each do |fixture_name|
23
23
  test_songs[fixture_name], throwaway_kit = song_parser.parse(base_path, File.read("test/fixtures/valid/#{fixture_name}.txt"))
@@ -33,18 +33,18 @@ class SongTest < Test::Unit::TestCase
33
33
  chorus.track "snare.wav", "....X..X"
34
34
  chorus.track "ride.wav", "X.....X."
35
35
  test_songs[:from_code].flow = [:verse, :chorus, :verse, :chorus, :chorus]
36
-
37
- return test_songs
36
+
37
+ test_songs
38
38
  end
39
-
39
+
40
40
  def test_initialize
41
41
  test_songs = generate_test_data()
42
-
42
+
43
43
  assert_equal([], test_songs[:blank].flow)
44
44
  assert_equal([], test_songs[:no_flow].flow)
45
45
  assert_equal([:verse, :chorus, :verse, :chorus, :chorus], test_songs[:from_code].flow)
46
46
  end
47
-
47
+
48
48
  def test_pattern
49
49
  song = Song.new()
50
50
  verse1 = song.pattern :Verse
@@ -61,10 +61,10 @@ class SongTest < Test::Unit::TestCase
61
61
  assert_equal(2, song.patterns.length)
62
62
  assert_equal({:Chorus => chorus, :Verse => verse2}, song.patterns)
63
63
  end
64
-
64
+
65
65
  def test_total_tracks
66
66
  test_songs = generate_test_data()
67
-
67
+
68
68
  assert_equal(0, test_songs[:blank].total_tracks)
69
69
  assert_equal(3, test_songs[:no_flow].total_tracks)
70
70
  assert_equal(3, test_songs[:from_code].total_tracks)
@@ -73,10 +73,10 @@ class SongTest < Test::Unit::TestCase
73
73
  assert_equal(5, test_songs[:example_no_kit].total_tracks)
74
74
  assert_equal(5, test_songs[:example_with_kit].total_tracks)
75
75
  end
76
-
76
+
77
77
  def test_track_names
78
78
  test_songs = generate_test_data()
79
-
79
+
80
80
  assert_equal([], test_songs[:blank].track_names)
81
81
  assert_equal(["bass.wav", "hh_closed.wav", "snare.wav"], test_songs[:no_flow].track_names)
82
82
  assert_equal(["bass.wav", "hh_closed.wav", "ride.wav", "snare.wav"], test_songs[:from_code].track_names)
@@ -96,25 +96,25 @@ class SongTest < Test::Unit::TestCase
96
96
  "test/sounds/ride_mono_8.wav"],
97
97
  test_songs[:example_with_kit].track_names)
98
98
  end
99
-
99
+
100
100
  def test_copy_ignoring_patterns_and_flow
101
101
  test_songs = generate_test_data()
102
102
  original_song = test_songs[:example_no_kit]
103
103
  cloned_song = original_song.copy_ignoring_patterns_and_flow()
104
-
104
+
105
105
  assert_not_equal(cloned_song, original_song)
106
106
  assert_equal(cloned_song.tempo, original_song.tempo)
107
107
  assert_equal([], cloned_song.flow)
108
108
  assert_equal({}, cloned_song.patterns)
109
109
  end
110
-
110
+
111
111
  def test_split
112
112
  test_songs = generate_test_data()
113
113
  split_songs = test_songs[:example_with_kit].split()
114
-
114
+
115
115
  assert_equal(Hash, split_songs.class)
116
116
  assert_equal(6, split_songs.length)
117
-
117
+
118
118
  song_names = split_songs.keys.sort
119
119
  assert_equal(["bass",
120
120
  "hhclosed",
@@ -123,7 +123,7 @@ class SongTest < Test::Unit::TestCase
123
123
  "test/sounds/hh_closed_mono_8.wav",
124
124
  "test/sounds/ride_mono_8.wav"],
125
125
  song_names)
126
-
126
+
127
127
  song_names.each do |song_name|
128
128
  song = split_songs[song_name]
129
129
  assert_equal(99, song.tempo)
@@ -131,7 +131,7 @@ class SongTest < Test::Unit::TestCase
131
131
  assert_equal([:verse, :verse, :chorus, :chorus, :verse, :verse, :chorus, :chorus, :chorus, :chorus,
132
132
  :bridge, :chorus, :chorus, :chorus, :chorus],
133
133
  song.flow)
134
-
134
+
135
135
  song.patterns.each do |pattern_name, pattern|
136
136
  assert_equal(1, pattern.tracks.length)
137
137
  assert_equal([song_name], pattern.tracks.keys)
@@ -139,20 +139,20 @@ class SongTest < Test::Unit::TestCase
139
139
  end
140
140
  end
141
141
  end
142
-
142
+
143
143
  def test_remove_unused_patterns
144
144
  test_songs = generate_test_data()
145
-
145
+
146
146
  assert_equal(1, test_songs[:no_flow].patterns.length)
147
147
  test_songs[:no_flow].remove_unused_patterns()
148
148
  assert_equal({}, test_songs[:no_flow].patterns)
149
-
149
+
150
150
  assert_equal(3, test_songs[:example_no_kit].patterns.length)
151
151
  test_songs[:example_no_kit].remove_unused_patterns()
152
152
  assert_equal(3, test_songs[:example_no_kit].patterns.length)
153
153
  assert_equal(Hash, test_songs[:example_no_kit].patterns.class)
154
154
  end
155
-
155
+
156
156
  def test_to_yaml
157
157
  test_songs = generate_test_data()
158
158
  kit = Kit.new("test/sounds", {"bass" => "bass_mono_8.wav",
@@ -161,7 +161,7 @@ class SongTest < Test::Unit::TestCase
161
161
  "hhopen" => "hh_open_mono_8.wav"})
162
162
 
163
163
  result = test_songs[:example_with_kit].to_yaml(kit)
164
-
164
+
165
165
  assert_equal(File.read("test/fixtures/yaml/song_yaml.txt"), result)
166
166
  end
167
167
  end