grok-itunes 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1024 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ $: << 'lib'
4
+
5
+ require 'test/unit'
6
+ require 'grok_itunes'
7
+ require 'time'
8
+ require 'pp'
9
+
10
+ ##
11
+ # Student Name: John Howe
12
+ # Homework Week: 8
13
+ #
14
+
15
+ $testfile = "./big.itunes.xml"
16
+
17
+ class TestGrokITunes < Test::Unit::TestCase
18
+ # accelerate read-only tests
19
+ static_data = GrokITunes.new($testfile)
20
+ static_data.parse_xml
21
+ static_data.init_db
22
+ static_data.populate_db
23
+ @@static_db = static_data.db
24
+ @@static_tracks = static_data.tracks
25
+ @@static_playlists = static_data.playlists
26
+
27
+ def setup
28
+ @grok = GrokITunes.new($testfile)
29
+ @grok.db = @@static_db
30
+ @grok.tracks = @@static_tracks
31
+ @grok.playlists = @@static_playlists
32
+ end
33
+
34
+ def test_init_valid_file_no_file
35
+ assert_raise FileNotFoundException do
36
+ @test = GrokITunes.new("./this_missing_file.xml")
37
+ end
38
+ end
39
+
40
+ def test_init_valid_file_empty_file
41
+ assert_raise FileEmptyException do
42
+ @test = GrokITunes.new("./empty.xml")
43
+ end
44
+ end
45
+
46
+ def test_fix_type_boolean_true
47
+ actual_true = @grok.fix_type("true", "boolean")
48
+ expected_true = true
49
+ assert_equal expected_true, actual_true
50
+ assert_instance_of TrueClass, actual_true
51
+ end
52
+
53
+ def test_fix_type_boolean_false
54
+ actual_false = @grok.fix_type("false", "boolean")
55
+ expected_false = false
56
+ assert_equal expected_false, actual_false
57
+ assert_instance_of FalseClass, actual_false
58
+ end
59
+
60
+ def test_fix_type_boolean_bogon
61
+ assert_raise NonBooleanValueException do
62
+ actual_bogon = @grok.fix_type("bogon", "boolean")
63
+ end
64
+ end
65
+
66
+ def test_fix_type_date
67
+ actual = @grok.fix_type("2008-08-30T19:55:51Z", "date")
68
+ expected = "2008-08-30T19:55:51"
69
+ assert_equal expected, actual
70
+ assert_instance_of String, actual
71
+ end
72
+
73
+ def test_fix_type_integer_fixnum
74
+ actual = @grok.fix_type("2", "integer")
75
+ expected = 2
76
+ assert_equal expected, actual
77
+ assert_instance_of Fixnum, actual
78
+ end
79
+
80
+ def test_fix_type_integer_bignum
81
+ actual = @grok.fix_type("3310678273", "integer")
82
+ expected = 3310678273
83
+ assert_equal expected, actual
84
+ assert_instance_of Bignum, actual
85
+ end
86
+
87
+ def test_fix_type_string
88
+ actual = @grok.fix_type("Test", "string")
89
+ expected = "Test"
90
+ assert_equal expected, actual
91
+ assert_instance_of String, actual
92
+ end
93
+
94
+ def test_fix_type_unknown
95
+ assert_raise UnknownDataTypeException do
96
+ actual = @grok.fix_type("<xml>test</xml>", "xml")
97
+ end
98
+ end
99
+
100
+ def test_human_clock_time_int
101
+ actual = @grok.human_clock_time(276854)
102
+ expected = "003:04:54:14"
103
+ assert_equal expected, actual
104
+ end
105
+
106
+ def test_human_clock_time_one_minute
107
+ actual = @grok.human_clock_time(60)
108
+ expected = "000:00:01:00"
109
+ assert_equal expected, actual
110
+ end
111
+
112
+ def test_human_clock_time_one_hour
113
+ actual = @grok.human_clock_time(3600)
114
+ expected = "000:01:00:00"
115
+ assert_equal expected, actual
116
+ end
117
+
118
+ def test_human_clock_time_one_day
119
+ actual = @grok.human_clock_time(86400)
120
+ expected = "001:00:00:00"
121
+ assert_equal expected, actual
122
+ end
123
+
124
+ def test_parse_xml_tracks_array_size
125
+ actual = @grok.tracks.size
126
+ expected = 4248
127
+ assert_equal expected, actual
128
+ end
129
+
130
+ def test_parse_xml_tracks_array_record_66_album
131
+ actual_album = @grok.tracks[66][:album]
132
+ expected_album = "Treasure"
133
+ assert_equal expected_album, actual_album
134
+ assert_instance_of String, actual_album
135
+ end
136
+
137
+ def test_parse_xml_tracks_array_record_66_album_artist
138
+ actual_album_artist = @grok.tracks[66][:album_artist]
139
+ expected_album_artist = nil
140
+ assert_equal expected_album_artist, actual_album_artist
141
+ # assert_instance_of String, actual_album_artist
142
+ end
143
+
144
+ def test_parse_xml_tracks_array_record_66_album_rating
145
+ actual_album_rating = @grok.tracks[66][:album_rating]
146
+ expected_album_rating = 80
147
+ assert_equal expected_album_rating, actual_album_rating
148
+ assert_instance_of Fixnum, actual_album_rating
149
+ end
150
+
151
+ def test_parse_xml_tracks_array_record_66_album_rating_computed
152
+ actual_album_rating_computed = @grok.tracks[66][:album_rating_computed]
153
+ expected_album_rating_computed = true
154
+ assert_equal expected_album_rating_computed, actual_album_rating_computed
155
+ assert_instance_of TrueClass, actual_album_rating_computed
156
+ end
157
+
158
+ def test_parse_xml_tracks_array_record_66_artist
159
+ actual_artist = @grok.tracks[66][:artist]
160
+ expected_artist = "Cocteau Twins"
161
+ assert_equal expected_artist, actual_artist
162
+ assert_instance_of String, actual_artist
163
+ end
164
+
165
+ def test_parse_xml_tracks_array_record_66_artwork_count
166
+ actual_artwork_count = @grok.tracks[66][:artwork_count]
167
+ expected_artwork_count = 1
168
+ assert_equal expected_artwork_count, actual_artwork_count
169
+ assert_instance_of Fixnum, actual_artwork_count
170
+ end
171
+
172
+ def test_parse_xml_tracks_array_record_66_bit_rate
173
+ actual_bit_rate = @grok.tracks[66][:bit_rate]
174
+ expected_bit_rate = 128
175
+ assert_equal expected_bit_rate, actual_bit_rate
176
+ assert_instance_of Fixnum, actual_bit_rate
177
+ end
178
+
179
+ def test_parse_xml_tracks_array_record_66_composer
180
+ actual_composer = @grok.tracks[66][:composer]
181
+ expected_composer = "Cocteau Twins"
182
+ assert_equal expected_composer, actual_composer
183
+ assert_instance_of String, actual_composer
184
+ end
185
+
186
+ def test_parse_xml_tracks_array_record_66_date_added
187
+ actual_date_added = @grok.tracks[66][:date_added]
188
+ expected_date_added = "2002-07-17T20:41:10"
189
+ assert_equal expected_date_added, actual_date_added
190
+ assert_instance_of String, actual_date_added
191
+ end
192
+
193
+ def test_parse_xml_tracks_array_record_66_date_modified
194
+ actual_date_modified = @grok.tracks[66][:date_modified]
195
+ expected_date_modified = "2005-10-18T17:03:07"
196
+ assert_equal expected_date_modified, actual_date_modified
197
+ assert_instance_of String, actual_date_modified
198
+ end
199
+
200
+ def test_parse_xml_tracks_array_record_66_disc_count
201
+ actual_disc_count = @grok.tracks[66][:disc_count]
202
+ expected_disc_count = 1
203
+ assert_equal expected_disc_count, actual_disc_count
204
+ assert_instance_of Fixnum, actual_disc_count
205
+ end
206
+
207
+ def test_parse_xml_tracks_array_record_66_disc_number
208
+ actual_disc_number = @grok.tracks[66][:disc_number]
209
+ expected_disc_number = 1
210
+ assert_equal expected_disc_number, actual_disc_number
211
+ assert_instance_of Fixnum, actual_disc_number
212
+ end
213
+
214
+ def test_parse_xml_tracks_array_record_66_file_creator
215
+ actual_file_creator = @grok.tracks[66][:file_creator]
216
+ expected_file_creator = nil
217
+ assert_equal expected_file_creator, actual_file_creator
218
+ end
219
+
220
+ def test_parse_xml_tracks_array_record_66_file_folder_count
221
+ actual_file_folder_count = @grok.tracks[66][:file_folder_count]
222
+ expected_file_folder_count = 4
223
+ assert_equal expected_file_folder_count, actual_file_folder_count
224
+ assert_instance_of Fixnum, actual_file_folder_count
225
+ end
226
+
227
+ def test_parse_xml_tracks_array_record_66_genre
228
+ actual_genre = @grok.tracks[66][:genre]
229
+ expected_genre = "Goth"
230
+ assert_equal expected_genre, actual_genre
231
+ assert_instance_of String, actual_genre
232
+ end
233
+
234
+ def test_parse_xml_tracks_array_record_66_kind
235
+ actual_kind = @grok.tracks[66][:kind]
236
+ expected_kind = "AAC audio file"
237
+ assert_equal expected_kind, actual_kind
238
+ assert_instance_of String, actual_kind
239
+ end
240
+
241
+ def test_parse_xml_tracks_array_record_66_library_folder_count
242
+ actual_library_folder_count = @grok.tracks[66][:library_folder_count]
243
+ expected_library_folder_count = 1
244
+ assert_equal expected_library_folder_count, actual_library_folder_count
245
+ assert_instance_of Fixnum, actual_library_folder_count
246
+ end
247
+
248
+ def test_parse_xml_tracks_array_record_66_location
249
+ actual_location = @grok.tracks[66][:location]
250
+ expected_location = "file://localhost/Users/user_missing/Music/iTunes/iTunes%20Music/Cocteau%20Twins/Treasure/01%20Ivo.m4a"
251
+ assert_equal expected_location, actual_location
252
+ assert_instance_of String, actual_location
253
+ end
254
+
255
+ def test_parse_xml_tracks_array_record_66_name
256
+ actual_name = @grok.tracks[66][:name]
257
+ expected_name = "Ivo"
258
+ assert_equal expected_name, actual_name
259
+ assert_instance_of String, actual_name
260
+ end
261
+
262
+ def test_parse_xml_tracks_array_record_66_persistent_id
263
+ actual_persistent_id = @grok.tracks[66][:persistent_id]
264
+ expected_persistent_id = "3CF1F47A0CA8D0B1"
265
+ assert_equal expected_persistent_id, actual_persistent_id
266
+ assert_instance_of String, actual_persistent_id
267
+ end
268
+
269
+ def test_parse_xml_tracks_array_record_66_play_count
270
+ actual_play_count = @grok.tracks[66][:play_count]
271
+ expected_play_count = 41
272
+ assert_equal expected_play_count, actual_play_count
273
+ assert_instance_of Fixnum, actual_play_count
274
+ end
275
+
276
+ def test_parse_xml_tracks_array_record_66_play_date
277
+ actual_play_date = @grok.tracks[66][:play_date]
278
+ expected_play_date = 3309728375
279
+ assert_equal expected_play_date, actual_play_date
280
+ assert_instance_of Bignum, actual_play_date
281
+ end
282
+
283
+ def test_parse_xml_tracks_array_record_66_play_date_utc
284
+ actual_play_date_utc = @grok.tracks[66][:play_date_utc]
285
+ expected_play_date_utc = "2008-11-17T08:59:35"
286
+ assert_equal expected_play_date_utc, actual_play_date_utc
287
+ assert_instance_of String, actual_play_date_utc
288
+ end
289
+
290
+ def test_parse_xml_tracks_array_record_66_purchased
291
+ actual_purchased = @grok.tracks[66][:purchased]
292
+ expected_purchased = nil
293
+ assert_equal expected_purchased, actual_purchased
294
+ end
295
+
296
+ def test_parse_xml_tracks_array_record_66_rating
297
+ actual_rating = @grok.tracks[66][:rating]
298
+ expected_rating = 100
299
+ assert_equal expected_rating, actual_rating
300
+ assert_instance_of Fixnum, actual_rating
301
+ end
302
+
303
+ def test_parse_xml_tracks_array_record_66_release_date
304
+ actual_release_date = @grok.tracks[66][:release_date]
305
+ expected_release_date = nil
306
+ assert_equal expected_release_date, actual_release_date
307
+ end
308
+
309
+ def test_parse_xml_tracks_array_record_66_sample_rate
310
+ actual_sample_rate = @grok.tracks[66][:sample_rate]
311
+ expected_sample_rate = 44100
312
+ assert_equal expected_sample_rate, actual_sample_rate
313
+ assert_instance_of Fixnum, actual_sample_rate
314
+ end
315
+
316
+ def test_parse_xml_tracks_array_record_66_size
317
+ actual_size = @grok.tracks[66][:size]
318
+ expected_size = 3934305
319
+ assert_equal expected_size, actual_size
320
+ assert_instance_of Fixnum, actual_size
321
+ end
322
+
323
+ def test_parse_xml_tracks_array_record_66_total_time
324
+ actual_total_time = @grok.tracks[66][:total_time]
325
+ expected_total_time = 233266
326
+ assert_equal expected_total_time, actual_total_time
327
+ assert_instance_of Fixnum, actual_total_time
328
+ end
329
+
330
+ def test_parse_xml_tracks_array_record_66_track_count
331
+ actual_track_count = @grok.tracks[66][:track_count]
332
+ expected_track_count = 10
333
+ assert_equal expected_track_count, actual_track_count
334
+ assert_instance_of Fixnum, actual_track_count
335
+ end
336
+
337
+ def test_parse_xml_tracks_array_record_66_track_id
338
+ actual_track_id = @grok.tracks[66][:track_id]
339
+ expected_track_id = 1045
340
+ assert_equal expected_track_id, actual_track_id
341
+ assert_instance_of Fixnum, actual_track_id
342
+ end
343
+
344
+ def test_parse_xml_tracks_array_record_66_track_number
345
+ actual_track_number = @grok.tracks[66][:track_number]
346
+ expected_track_number = 1
347
+ assert_equal expected_track_number, actual_track_number
348
+ assert_instance_of Fixnum, actual_track_number
349
+ end
350
+
351
+ def test_parse_xml_tracks_array_record_66_track_type
352
+ actual_track_type = @grok.tracks[66][:track_type]
353
+ expected_track_type = "File"
354
+ assert_equal expected_track_type, actual_track_type
355
+ assert_instance_of String, actual_track_type
356
+ end
357
+
358
+ def test_parse_xml_tracks_array_record_66_year
359
+ actual_year = @grok.tracks[66][:year]
360
+ expected_year = 1984
361
+ assert_equal expected_year, actual_year
362
+ assert_instance_of Fixnum, actual_year
363
+ end
364
+
365
+ # Playlist tests
366
+
367
+ def test_parse_xml_playlists_array_size
368
+ actual = @grok.playlists.size
369
+ expected = 40
370
+ assert_equal expected, actual
371
+ end
372
+
373
+ def test_parse_xml_playlists_genius_all_items
374
+ actual_all_items = @grok.playlists[8][0][:all_items]
375
+ expected_all_items = true
376
+ assert_equal expected_all_items, actual_all_items
377
+ assert_instance_of TrueClass, actual_all_items
378
+ end
379
+
380
+ def test_parse_xml_playlists_genius_distinguished_kind
381
+ actual = @grok.playlists[8][0][:distinguished_kind]
382
+ expected = 26
383
+ assert_equal expected, actual
384
+ assert_kind_of Fixnum, actual
385
+ end
386
+
387
+ def test_parse_xml_playlists_genius_genius_track_id
388
+ actual = @grok.playlists[8][0][:genius_track_id]
389
+ expected = 5381
390
+ assert_equal expected, actual
391
+ assert_instance_of Fixnum, actual
392
+ end
393
+
394
+ def test_parse_xml_playlists_genius_name
395
+ actual_name = @grok.playlists[8][0][:name]
396
+ expected_name = "Genius"
397
+ assert_equal expected_name, actual_name
398
+ assert_instance_of String, actual_name
399
+ end
400
+
401
+ def test_parse_xml_playlists_genious_playlist_id
402
+ actual_playlist_id = @grok.playlists[8][0][:playlist_id]
403
+ expected_playlist_id = 31144
404
+ assert_equal expected_playlist_id, actual_playlist_id
405
+ assert_instance_of Fixnum, actual_playlist_id
406
+ end
407
+
408
+ def test_parse_xml_playlists_genius_playlist_persistent_id
409
+ actual_persistent_id = @grok.playlists[8][0][:playlist_persistent_id]
410
+ expected_persistent_id = "AFBA9D1CC404A519"
411
+ assert_equal expected_persistent_id, actual_persistent_id
412
+ assert_instance_of String, actual_persistent_id
413
+ end
414
+
415
+ def test_parse_xml_playlists_genius_playlists
416
+ actual_playlist_items = @grok.playlists[8][1]
417
+ expected_playlist_items = [
418
+ 5381,3037,2633,3367,4213,3397,2949,1047,5677,6793,5345,1795,8921,2349,6361,
419
+ 3063,5371,3829,1775,953,1043,2631,6831,7083,2023,1767,5391,7897,4857,5973,
420
+ 4935,995,5357,5377,5491,8231,3047,3067,1889,8207,6835,7459,945,3041,2343,
421
+ 2025,5769,7249,1007,1273
422
+ ]
423
+ assert_equal expected_playlist_items, actual_playlist_items
424
+ assert_instance_of Array, actual_playlist_items
425
+ end
426
+
427
+ # Database tests
428
+
429
+ def test_init_db_create
430
+ @test = GrokITunes.new("./test.xml")
431
+ @test.init_db
432
+
433
+ assert_instance_of SQLite3::Database, @test.db
434
+ assert_nothing_raised do
435
+ File.open("./test.xml.db")
436
+ end
437
+ assert File.size?("./test.xml.db") > 0
438
+ end
439
+
440
+ def test_populate_db
441
+ @test = GrokITunes.new("./test.xml")
442
+ @test.init_db
443
+
444
+ assert_nothing_thrown do
445
+ @test.populate_db
446
+ end
447
+ assert File.exist?("./test.xml.db")
448
+ assert File.size("./test.xml.db") >= 8192
449
+ end
450
+
451
+ def test_populate_tracks_db_record_count
452
+ actual_array_size = @grok.tracks.size
453
+ expected_array_size = 4248
454
+ assert_equal expected_array_size, actual_array_size
455
+
456
+ actual_tracks = @grok.db.execute("select * from tracks").size.to_i
457
+ expected_tracks = 4248
458
+ assert_equal expected_tracks, actual_tracks
459
+ end
460
+
461
+ # Specification requirements
462
+
463
+ def test_artist_count
464
+ actual = @grok.count_artists
465
+ expected = 247
466
+ assert_equal expected, actual
467
+ end
468
+
469
+ def test_album_count
470
+ actual = @grok.count_albums
471
+ expected = 397
472
+ assert_equal expected, actual
473
+ end
474
+
475
+ def test_track_count
476
+ actual = @grok.count_tracks
477
+ expected = 4248
478
+ assert_equal expected, actual
479
+ end
480
+
481
+ def test_total_playtime
482
+ actual = @grok.total_time
483
+ expected = "014:06:27:51"
484
+ assert_equal expected, actual
485
+ end
486
+
487
+ def test_top_artists
488
+ actual = @grok.top_artists
489
+ expected = [
490
+ ["149", "Nine Inch Nails"],
491
+ ["139", "Depeche Mode"],
492
+ ["129", "The Cure"],
493
+ ["120", "Siouxsie &#38; the Banshees"],
494
+ ["95", "New Model Army"],
495
+ ["89", "The Police"],
496
+ ["88", "Cocteau Twins"],
497
+ ["84", "Peter Murphy"],
498
+ ["81", "DJ Krush"],
499
+ ["77", "Bauhaus"]
500
+ ]
501
+ assert_equal expected, actual
502
+ end
503
+
504
+ def test_top_genres
505
+ actual = @grok.top_genres
506
+ expected = [
507
+ ["1433", "Alternative"],
508
+ ["727", "Goth"],
509
+ ["640", "Electronic"],
510
+ ["525", "Industrial"],
511
+ ["407", "Rock"],
512
+ ["222", "Punk"],
513
+ ["67", "World"],
514
+ ["60", "Podcast"],
515
+ ["40", "Soundtrack"],
516
+ ["38", "New Age"]
517
+ ]
518
+ assert_equal expected, actual
519
+ end
520
+
521
+ def test_top_tracks_on_rating_times_playcount
522
+ actual = @grok.top_tracks_on_rating_times_playcount
523
+ expected = [
524
+ ["8000", "Carnage Visors", "The Cure", "2008-09-17 12:10:59"],
525
+ ["6640", "Future Proof", "Massive Attack", "2008-10-02 05:57:15"],
526
+ ["6500", "Group Four", "Massive Attack", "2008-09-17 18:54:47"],
527
+ ["6400", "Teardrop", "Massive Attack", "2008-10-23 05:57:05"],
528
+ ["6000", "Angel", "Massive Attack", "2008-10-07 12:51:24"],
529
+ ["5800", "Special Cases", "Massive Attack", "2008-10-06 17:01:13"],
530
+ ["5600", "Inertia Creeps", "Massive Attack", "2008-10-23 07:16:22"],
531
+ ["5500", "Dissolved Girl", "Massive Attack", "2008-10-06 16:15:23"],
532
+ ["5300", "No New Tale To Tell", "Love &#38; Rockets", "2008-11-03 01:48:38"],
533
+ ["5100", "Risingson", "Massive Attack", "2008-10-18 08:53:14"]
534
+ ]
535
+ assert_equal expected, actual
536
+ end
537
+
538
+ def test_oldest_tracks
539
+ actual = @grok.oldest_tracks
540
+ expected = [
541
+ ["2002-08-15 18:14:03", "Introduction"],
542
+ ["2003-11-13 19:26:53", "Segue: Ramona A. Stone/I Am With Name"],
543
+ ["2003-12-23 08:02:11", "Mother / Oh Mein Pa Pa"],
544
+ ["2003-12-23 08:59:40", "Shame"],
545
+ ["2004-02-27 18:45:22", "Fourteen"],
546
+ ["2004-03-22 04:31:04", "To Have And To Hold"],
547
+ ["2004-04-20 06:52:50", "Over And Out"],
548
+ ["2004-05-06 03:23:40", "The Theft"],
549
+ ["2004-06-08 10:32:05", "Sins Of The Fathers"],
550
+ ["2004-07-02 23:01:19", "Back On Earth"]
551
+ ]
552
+ assert_equal expected, actual
553
+ end
554
+
555
+ def test_top_tracks_aging_well
556
+ @grok.now = Time.parse("Tue Dec 09 18:00:00 -0800 2008")
557
+ actual = @grok.top_tracks_aging_well
558
+ expected = [
559
+ [35350,"Carnage Visors","The Cure","2008-09-17 12:10:59"],
560
+ [28722,"Group Four","Massive Attack","2008-09-17 18:54:47"],
561
+ [28017,"Future Proof","Massive Attack","2008-10-02 05:57:15"],
562
+ [24858,"Angel","Massive Attack","2008-10-07 12:51:24"],
563
+ [24640,"Teardrop","Massive Attack","2008-10-23 05:57:05"],
564
+ [24121,"Special Cases","Massive Attack","2008-10-06 17:01:13"],
565
+ [22873,"Dissolved Girl","Massive Attack","2008-10-06 16:15:23"],
566
+ [21560,"Inertia Creeps","Massive Attack","2008-10-23 07:16:22"],
567
+ [20794,"One Hundred Years","The Cure","2008-10-06 10:56:13"],
568
+ [20715,"A Prayer For England","Massive Attack","2008-10-07 15:00:18"]
569
+ ]
570
+ assert_equal expected, actual
571
+ end
572
+
573
+ # def test_related_artists_to_massive_attack
574
+ # actual = @grok.related_artists_to("Massive Attack")
575
+ # expected = [
576
+ # [ "100", "Tricky"],
577
+ # [ "88.11", "Portishead"],
578
+ # [ "86.29", "Lamb"],
579
+ # [ "85.56", "UNKLE"],
580
+ # [ "70.22", "Hooverphonic"],
581
+ # [ "66.65", "Morcheeba"],
582
+ # [ "57.6", "Sneaker Pimps"],
583
+ # [ "54.42", "Massive Attack vs. Mad Professor"],
584
+ # [ "53.85", "Thievery Corporation"],
585
+ # [ "51.83", "Archive"]
586
+ # ]
587
+ # assert_equal expected, actual
588
+ # end
589
+
590
+ def test_small_files_256_k
591
+ actual = @grok.small_files(262144)
592
+ expected = [
593
+ [138823, "-", "ohGr", "file://localhost/Users/user_missing/Music/iTunes/iTunes%20Music/ohGr/Sunnypsyop/11%20-.m4a"],
594
+ [138823, "-", "ohGr", "file://localhost/Users/user_missing/Music/iTunes/iTunes%20Music/ohGr/Sunnypsyop/12%20-.m4a"],
595
+ [216760, "ALL", "Descendents", "file://localhost/Users/user_missing/Music/iTunes/iTunes%20Music/Descendents/ALL/01%20ALL.m4a"],
596
+ [228155, "No, All", "Descendents", "file://localhost/Users/user_missing/Music/iTunes/iTunes%20Music/Descendents/ALL/03%20No,%20All.m4a"]
597
+ ]
598
+ assert_equal expected, actual
599
+ end
600
+
601
+ def test_rating_fanatic
602
+ actual = @grok.rating_fanatic
603
+ expected = [
604
+ [0, 0, 56, 4248, 0.0132],
605
+ [20, 110, 110, 4248, 0.0259],
606
+ [40, 358, 358, 4248, 0.0843],
607
+ [60, 1457, 1457, 4248, 0.343],
608
+ [80, 1418, 1418, 4248, 0.3338],
609
+ [100, 849, 849, 4248, 0.1999]
610
+ ]
611
+ assert_equal expected, actual
612
+ end
613
+
614
+ def test_find_buggy_itunes_files
615
+ actual = @grok.find_buggy_itunes_files
616
+ expected = []
617
+ assert_equal expected, actual
618
+ #Bill Frisell|Live 10.04.1996 NYC|02 02 - john zorn's masada &#38; bill frisell - live 10.04.1996 nyc|file://localhost/Volumes/BAQUA/jhowe/Music/iTunes/iTunes%20Music/Bill%20Frisell/Live%2010.04.1996%20NYC/02%2002%20-%20john%20zorn's%20masada%20&#38;%20bill%20frisell%20-%20live%2010.04.1996%20nyc.mp3
619
+ #Buck 65|North American Adonis [ep]|02 02 Side B|file://localhost/Volumes/BAQUA/jhowe/Music/iTunes/iTunes%20Music/Compilations/North%20American%20Adonis%20%5Bep%5D/02%2002%2002%20Side%20B.mp3
620
+ #Lewis Black|Revolver|02 02 02 02 02 Lewis Black [Revolver (outtakes from The White Album)] 02 Outtakes|file://localhost/Volumes/BAQUA/jhowe/Music/iTunes/iTunes%20Music/Lewis%20Black/Revolver/02%2002%2002%2002%2002%2002%20Lewis%20Black%20%5BRevolver%20(outtakes%20from%20The%20White%20Album)%5D%2002%20Outtakes.mp3
621
+ #...
622
+ end
623
+
624
+ def test_find_trailing_spaces_artist
625
+ actual = @grok.find_trailing_spaces('artist')
626
+ expected = []
627
+ assert_equal expected, actual
628
+ #(Gus Gus)
629
+ #01 Lost At Last
630
+ #03. Healer
631
+ #...
632
+ end
633
+
634
+ def test_find_trailing_spaces_album
635
+ actual = @grok.find_trailing_spaces('album')
636
+ expected = []
637
+ assert_equal expected, actual
638
+ #9 Dream
639
+ #02
640
+ #03
641
+ #...
642
+ end
643
+
644
+ def test_bad_track_names_mp3
645
+ actual = @grok.bad_track_names('mp3')
646
+ expected = []
647
+ assert_equal expected, actual
648
+ # Keepinit Steel (The Anvil Track).mp3|file://localhost/Volumes/BAQUA/jhowe/Music/iTunes/iTunes%20Music/Amon%20Tobin/Unknown%20Album/_Keepinit%20Steel%20(The%20Anvil%20Track).mp3.mp3
649
+ #-.mp3|file://localhost/Volumes/BAQUA/jhowe/Music/iTunes/iTunes%20Music/08.%20Bark%20Pschosis/~08.%20Bark%20Pschosis/-.mp3.mp3
650
+ #-Smith &#38; Mighty -06 -Quite frankly (DJ Lynx).mp3|file://localhost/Volumes/BAQUA/jhowe/Music/iTunes/iTunes%20Music/DJ/Kicks/-Smith%20&#38;%20Mighty%20-06%20-Quite%20frankly%20(DJ%20Lynx).mp3.mp3
651
+ #...
652
+ end
653
+
654
+ def test_bad_track_names_m4a
655
+ actual = @grok.bad_track_names('m4a')
656
+ expected = []
657
+ assert_equal expected, actual
658
+ #nil, since purchase music is "perfect"
659
+ end
660
+
661
+ def test_clean_tracks
662
+ actual = @grok.clean_tracks
663
+ expected = []
664
+ assert_equal expected, actual
665
+ end
666
+
667
+ def test_explicit_tracks
668
+ actual = @grok.explicit_tracks
669
+ expected = [
670
+ ["Mosh", "Eminem", "Mosh - Single", true],
671
+ ["Private Hell", "Iggy Pop", "Skull Ring", true],
672
+ ["Mama Said Knock You Out", "LL Cool J", "LL Cool J: All World - Greatest Hits", true],
673
+ ["Make Love Fuck War (Dirty Version)", "Moby &#38; Public Enemy", "Make Love Fuck War", true],
674
+ ["Dead Souls", "Nine Inch Nails", "The Downward Spiral (Deluxe Edition)", true]
675
+ ]
676
+ assert_equal expected, actual
677
+ end
678
+
679
+ def test_not_rated
680
+ actual = @grok.tracks_not_rated
681
+ expected = [
682
+ ["TEDTalks (video)", "Brewster Kahle", "TEDTalks : A digital library, free to the world - Brewster Kahle (2007)"],
683
+ ["TEDTalks (video)", "Chris Abani", "TEDTalks : Telling stories of our shared humanity - Chris Abani (2008)"],
684
+ ["TEDTalks (video)", "Clay Shirky", "TEDTalks : Institutions vs. collaboration - Clay Shirky (2005)"],
685
+ ["TEDTalks (video)", "Corneille Ewango", "TEDTalks : A hero of the Congo Basin forest - Corneille Ewango (2007)"],
686
+ ["TEDTalks (video)", "David Gallo", "TEDTalks : The deep oceans: a ribbon of life - David Gallo (1998)"],
687
+ ["TEDTalks (video)", "David S. Rose", "TEDTalks : 10 things to know before you pitch a VC for money - David S. Rose (2007)"],
688
+ ["TEDTalks (video)", "Doris Kearns Goodwin", "TEDTalks : What we can learn from past presidents - Doris Kearns Goodwin (2008)"],
689
+ ["TEDTalks (video)", "Freeman Dyson", "TEDTalks : Let's look for life in the outer solar system - Freeman Dyson (2003)"],
690
+ ["TEDTalks (video)", "Garrett Lisi", "TEDTalks : Have I found the holy grail of physics? - Garrett Lisi (2008)"],
691
+ ["TEDTalks (video)", "George Dyson", "TEDTalks : The birth of the computer - George Dyson (2003)"],
692
+ ["TEDTalks (video)", "Graham Hawkes", "TEDTalks : Fly the seas on a submarine with wings - Graham Hawkes (2005)"],
693
+ ["TEDTalks (video)", "Helen Fisher", "TEDTalks : The brain in love - Helen Fisher (2008)"],
694
+ ["TEDTalks (video)", "Jane Goodall", "TEDTalks : Helping humans and animals live together in Africa - Jane Goodall (2007)"],
695
+ ["TEDTalks (video)", "Jared Diamond", "TEDTalks : Why societies collapse - Jared Diamond (2003)"],
696
+ ["TEDTalks (video)", "John Markoff", "TEDTalks : Why newspapers still matter (and why tech news belongs on the front page) - John Markoff (2007)"],
697
+ ["TEDTalks (video)", "Jonathan Haidt", "TEDTalks : The real difference between liberals and conservatives - Jonathan Haidt (2008)"],
698
+ ["TEDTalks (video)", "Jonathan Harris", "TEDTalks : The art of collecting stories - Jonathan Harris (2007)"],
699
+ ["TEDTalks (video)", "Kevin Kelly", "TEDTalks : Predicting the next 5,000 days of the web - Kevin Kelly (2007)"],
700
+ ["TEDTalks (video)", "Kwabena Boahen", "TEDTalks : Making a computer that works like the brain - Kwabena Boahen (2007)"],
701
+ ["TEDTalks (video)", "Lee Smolin", "TEDTalks : How science is like democracy - Lee Smolin (2003)"],
702
+ ["TEDTalks (video)", "Liz Diller", "TEDTalks : Architecture is a special effects machine - Liz Diller (2007)"],
703
+ ["TEDTalks (video)", "Louise Leakey", "TEDTalks : Digging for humanity's origins - Louise Leakey (2008)"],
704
+ ["TEDTalks (video)", "Luca Turin", "TEDTalks : The science of scent - Luca Turin (2005)"],
705
+ ["TEDTalks (video)", "Newton Aduaka", "TEDTalks : The story of Ezra, a child soldier - Newton Aduaka (2007)"],
706
+ ["TEDTalks (video)", "Nicholas Negroponte", "TEDTalks : One Laptop per Child, two years on - Nicholas Negroponte (2007)"],
707
+ ["TEDTalks (video)", "Paola Antonelli", "TEDTalks : Design and the elastic mind - Paola Antonelli (2007)"],
708
+ ["TEDTalks (video)", "Patricia Burchat", "TEDTalks : The search for dark energy and dark matter - Patricia Burchat (2008)"],
709
+ ["TEDTalks (video)", "Paul Rothemund", "TEDTalks : The astonishing promise of DNA folding - Paul Rothemund (2008)"],
710
+ ["TEDTalks (video)", "Peter Hirshberg", "TEDTalks : The Web and TV, a sibling rivalry - Peter Hirshberg (2007)"],
711
+ ["TEDTalks (video)", "Robert Full", "TEDTalks : How engineers learn from evolution - Robert Full (2002)"],
712
+ ["TEDTalks (video)", "Rodney Brooks", "TEDTalks : How robots will invade our lives - Rodney Brooks (2003)"],
713
+ ["TEDTalks (video)", "Spencer Wells", "TEDTalks : Building a family tree for all humanity - Spencer Wells (2007)"],
714
+ ["TEDTalks (video)", "Steven Johnson", "TEDTalks : The Web and the city as self-repairing - Steven Johnson (2003)"],
715
+ ["TEDTalks (video)", "Stewart Brand", "TEDTalks : Building a home for the Clock of the Long Now - Stewart Brand (2004)"],
716
+ ["TEDTalks (video)", "Sugata Mitra", "TEDTalks : Can kids teach themselves? - Sugata Mitra (2007)"],
717
+ ["TEDTalks (video)", "TED", "TEDTalks : Can we domesticate germs? - Paul Ewald (2007)"],
718
+ ["TEDTalks (video)", "TED", "TEDTalks : Exploring the ocean's hidden worlds - Robert Ballard (2008)"],
719
+ ["TEDTalks (video)", "TED", "TEDTalks : Sir Martin Rees (2005) video"],
720
+ ["TEDTalks (video)", "TED", "TEDTalks : What's wrong with what we eat - Mark Bittman (2007)"],
721
+ ["TEDTalks (video)", "TED", "TEDTalks: Brian Greene (2005)"],
722
+ ["TEDTalks (video)", "TED", "TEDTalks: Craig Venter (2005) video"],
723
+ ["TEDTalks (video)", "TED", "TEDTalks: Ernest Madu (2007)"],
724
+ ["TEDTalks (video)", "TED", "TEDTalks: Hector Ruiz (2007)"],
725
+ ["TEDTalks (video)", "TED", "TEDTalks: Jill Taylor (2008)"],
726
+ ["TEDTalks (video)", "TED", "TEDTalks: Juan Enriquez (2003) video"],
727
+ ["TEDTalks (video)", "TED", "TEDTalks: Juan Enriquez (2007)"],
728
+ ["TEDTalks (video)", "TED", "TEDTalks: Karen Armstrong (2008)"],
729
+ ["TEDTalks (video)", "TED", "TEDTalks: Michael Pollan (2007)"],
730
+ ["TEDTalks (video)", "TED", "TEDTalks: Neil Turok (2008)"],
731
+ ["TEDTalks (video)", "TED", "TEDTalks: Robert Full (2005)"],
732
+ ["TEDTalks (video)", "TED", "TEDTalks: Ron Eglash (2007)"],
733
+ ["TEDTalks (video)", "TED", "TEDTalks: Tod Machover, Dan Ellsey (2008)"],
734
+ ["TEDTalks (video)", "TED", "TEDTalks: Yochai Benkler (2005)"],
735
+ ["TEDTalks (video)", "Virginia Postrel", "TEDTalks : The power of glamour - Virginia Postrel (2004)"],
736
+ ["TEDTalks (video)", "Wade Davis", "TEDTalks : The worldwide web of belief and ritual - Wade Davis (2008)"],
737
+ ["iPhone Getting Started Videos", "Apple Developer Connection", "Fundamentals of Cocoa Session from WWDC"]
738
+ ]
739
+ assert_equal expected, actual
740
+ end
741
+
742
+ def test_podcast_without_genre
743
+ actual = @grok.podcast_without_genre
744
+ expected = [
745
+ ["Bin Laden feat. Mos Def", "Immortal Technique"],
746
+ ["Dollar Day for New Orleans ... Katrina Klap", "Mos Def"],
747
+ ["Ryan Davis Vs Marthin Luter King [ Strano Mash Up ]", ""],
748
+ ["The Other Voice", "King Black Acid"]
749
+ ]
750
+ assert_equal expected, actual
751
+ end
752
+
753
+ def test_spam_tunes
754
+ actual = @grok.spam_tunes
755
+ expected = [
756
+ ["The Brunching Shuttlecocks", "www.brunching.com", "The Bjork Song"],
757
+ ["dINbOT", "www.dinbot.com", "Bathroom Grammar (English Beat vs Nelly)"],
758
+ ["dINbOT", "www.dinbot.com", "Beastie Bop (Ramones vs Beastie Boys)"],
759
+ ["dINbOT", "www.dinbot.com", "Gay Paranoia (Black Sabbath vs Electric 6)"],
760
+ ["dINbOT", "www.dinbot.com", "Hell On Wheelz (Thrill Kill Kult vs. No Doubt)"],
761
+ ["dINbOT", "www.dinbot.com", "Paintin' Paintin' (Rolling Stones vs Destiny's Child)"],
762
+ ["dINbOT", "www.dinbot.com", "Tom's Penis (King Missile vs. Suzanne Vega)"],
763
+ ["dINbOT", "www.dinbot.com", "Whipsta (Devo vs. 50 Cent)"],
764
+ ["dINbOT", "www.dinbot.com", "World of Flesh (One Inch Punch vs Morcheeba)"]
765
+ ]
766
+ assert_equal expected, actual
767
+ end
768
+
769
+ def test_never_played
770
+ actual = @grok.never_played
771
+ expected = [
772
+ ["Alice Cooper", "Welcome To My Nightmare", "Cold Ethyl"],
773
+ ["Alice Cooper", "Welcome To My Nightmare", "Department Of Youth"],
774
+ ["Alice Cooper", "Welcome To My Nightmare", "Escape"],
775
+ ["Alice Cooper", "Welcome To My Nightmare", "Only Women Bleed"],
776
+ ["Alice Cooper", "Welcome To My Nightmare", "Some Folks"],
777
+ ["Alice Cooper", "Welcome To My Nightmare", "The Awakening"],
778
+ ["Alice Cooper", "Welcome To My Nightmare", "Years Ago"],
779
+ ["Apple Developer Connection", "iPhone Getting Started Videos", "Fundamentals of Cocoa Session from WWDC"],
780
+ ["Bauhaus", "Mask", "David Jay/Peter Murphy/Kevin Haskins/Daniel Ash"],
781
+ ["Bethany Curve", "Gold", "(Unknown)"],
782
+ ["Brewster Kahle", "TEDTalks (video)", "TEDTalks : A digital library, free to the world - Brewster Kahle (2007)"],
783
+ ["Chris Abani", "TEDTalks (video)", "TEDTalks : Telling stories of our shared humanity - Chris Abani (2008)"],
784
+ ["Chrome", "Anthology 1979 - 1983", "Chromosome Damage"],
785
+ ["Clay Shirky", "TEDTalks (video)", "TEDTalks : Institutions vs. collaboration - Clay Shirky (2005)"],
786
+ ["Corneille Ewango", "TEDTalks (video)", "TEDTalks : A hero of the Congo Basin forest - Corneille Ewango (2007)"],
787
+ ["Course Of Empire", "Course Of Empire", "Coming Of The Century"],
788
+ ["David Gallo", "TEDTalks (video)", "TEDTalks : The deep oceans: a ribbon of life - David Gallo (1998)"],
789
+ ["David J.", "V For Vendetta", "Incidental"],
790
+ ["David S. Rose", "TEDTalks (video)", "TEDTalks : 10 things to know before you pitch a VC for money - David S. Rose (2007)"],
791
+ ["Dead Kennedys", "Give Me Convenience or Give Me Death", "The Man With The Dogs"],
792
+ ["Doris Kearns Goodwin", "TEDTalks (video)", "TEDTalks : What we can learn from past presidents - Doris Kearns Goodwin (2008)"],
793
+ ["Freeman Dyson", "TEDTalks (video)", "TEDTalks : Let's look for life in the outer solar system - Freeman Dyson (2003)"],
794
+ ["Garrett Lisi", "TEDTalks (video)", "TEDTalks : Have I found the holy grail of physics? - Garrett Lisi (2008)"],
795
+ ["George Dyson", "TEDTalks (video)", "TEDTalks : The birth of the computer - George Dyson (2003)"],
796
+ ["Graham Hawkes", "TEDTalks (video)", "TEDTalks : Fly the seas on a submarine with wings - Graham Hawkes (2005)"],
797
+ ["Helen Fisher", "TEDTalks (video)", "TEDTalks : The brain in love - Helen Fisher (2008)"],
798
+ ["Jane Goodall", "TEDTalks (video)", "TEDTalks : Helping humans and animals live together in Africa - Jane Goodall (2007)"],
799
+ ["Jared Diamond", "TEDTalks (video)", "TEDTalks : Why societies collapse - Jared Diamond (2003)"],
800
+ ["John Corigliano", "Red Violin", "People's Revolution; Death of Chou Yuan"],
801
+ ["John Markoff", "TEDTalks (video)", "TEDTalks : Why newspapers still matter (and why tech news belongs on the front page) - John Markoff (2007)"],
802
+ ["Jonathan Haidt", "TEDTalks (video)", "TEDTalks : The real difference between liberals and conservatives - Jonathan Haidt (2008)"],
803
+ ["Jonathan Harris", "TEDTalks (video)", "TEDTalks : The art of collecting stories - Jonathan Harris (2007)"],
804
+ ["Kevin Kelly", "TEDTalks (video)", "TEDTalks : Predicting the next 5,000 days of the web - Kevin Kelly (2007)"],
805
+ ["Kevin MacLeod", "Royalty Free 2008", "Serpentine Trek"],
806
+ ["Kill Sister Kill", "The Disease of Lady Madeline", "Poisonous Fix"],
807
+ ["Kwabena Boahen", "TEDTalks (video)", "TEDTalks : Making a computer that works like the brain - Kwabena Boahen (2007)"],
808
+ ["Lee Smolin", "TEDTalks (video)", "TEDTalks : How science is like democracy - Lee Smolin (2003)"],
809
+ ["Liz Diller", "TEDTalks (video)", "TEDTalks : Architecture is a special effects machine - Liz Diller (2007)"],
810
+ ["Louise Leakey", "TEDTalks (video)", "TEDTalks : Digging for humanity's origins - Louise Leakey (2008)"],
811
+ ["Love &#38; Rockets", "Swing!", "Radio Session-Interview"],
812
+ ["Luca Turin", "TEDTalks (video)", "TEDTalks : The science of scent - Luca Turin (2005)"],
813
+ ["Ministry", "Animositisomina", "Stolen"],
814
+ ["Newton Aduaka", "TEDTalks (video)", "TEDTalks : The story of Ezra, a child soldier - Newton Aduaka (2007)"],
815
+ ["Nicholas Negroponte", "TEDTalks (video)", "TEDTalks : One Laptop per Child, two years on - Nicholas Negroponte (2007)"],
816
+ ["Paola Antonelli", "TEDTalks (video)", "TEDTalks : Design and the elastic mind - Paola Antonelli (2007)"],
817
+ ["Patricia Burchat", "TEDTalks (video)", "TEDTalks : The search for dark energy and dark matter - Patricia Burchat (2008)"],
818
+ ["Paul Rothemund", "TEDTalks (video)", "TEDTalks : The astonishing promise of DNA folding - Paul Rothemund (2008)"],
819
+ ["Peter Hirshberg", "TEDTalks (video)", "TEDTalks : The Web and TV, a sibling rivalry - Peter Hirshberg (2007)"],
820
+ ["Peter Murphy", "Unshattered", "Blinded Like Saul"],
821
+ ["Peter Murphy", "Unshattered", "Breaking No One's Heaven"],
822
+ ["Peter Murphy", "Unshattered", "Emergency Unit"],
823
+ ["Peter Murphy", "Unshattered", "Face the Moon"],
824
+ ["Peter Murphy", "Unshattered", "Give What He's Got"],
825
+ ["Peter Murphy", "Unshattered", "The First Stone"],
826
+ ["Peter Murphy", "Unshattered", "The Weight of Love"],
827
+ ["Peter Murphy", "Unshattered", "Thelma Sigs To Little Nell"],
828
+ ["Robert Full", "TEDTalks (video)", "TEDTalks : How engineers learn from evolution - Robert Full (2002)"],
829
+ ["Rodney Brooks", "TEDTalks (video)", "TEDTalks : How robots will invade our lives - Rodney Brooks (2003)"],
830
+ ["Spencer Wells", "TEDTalks (video)", "TEDTalks : Building a family tree for all humanity - Spencer Wells (2007)"],
831
+ ["Steven Johnson", "TEDTalks (video)", "TEDTalks : The Web and the city as self-repairing - Steven Johnson (2003)"],
832
+ ["Stewart Brand", "TEDTalks (video)", "TEDTalks : Building a home for the Clock of the Long Now - Stewart Brand (2004)"],
833
+ ["Sugata Mitra", "TEDTalks (video)", "TEDTalks : Can kids teach themselves? - Sugata Mitra (2007)"],
834
+ ["Swans", "Swans Are Dead (White Disc)", "Final Sac"],
835
+ ["TED", "TEDTalks (video)", "TEDTalks : Can we domesticate germs? - Paul Ewald (2007)"],
836
+ ["TED", "TEDTalks (video)", "TEDTalks : Exploring the ocean's hidden worlds - Robert Ballard (2008)"],
837
+ ["TED", "TEDTalks (video)", "TEDTalks : Hans Rosling (2006) video"],
838
+ ["TED", "TEDTalks (video)", "TEDTalks : Malcolm Gladwell (2004) video"],
839
+ ["TED", "TEDTalks (video)", "TEDTalks : Sir Martin Rees (2005) video"],
840
+ ["TED", "TEDTalks (video)", "TEDTalks : What's wrong with what we eat - Mark Bittman (2007)"],
841
+ ["TED", "TEDTalks (video)", "TEDTalks: Brian Greene (2005)"],
842
+ ["TED", "TEDTalks (video)", "TEDTalks: Craig Venter (2005) video"],
843
+ ["TED", "TEDTalks (video)", "TEDTalks: Ernest Madu (2007)"],
844
+ ["TED", "TEDTalks (video)", "TEDTalks: Hector Ruiz (2007)"],
845
+ ["TED", "TEDTalks (video)", "TEDTalks: Jill Taylor (2008)"],
846
+ ["TED", "TEDTalks (video)", "TEDTalks: Juan Enriquez (2003) video"],
847
+ ["TED", "TEDTalks (video)", "TEDTalks: Karen Armstrong (2008)"],
848
+ ["TED", "TEDTalks (video)", "TEDTalks: Neil Turok (2008)"],
849
+ ["TED", "TEDTalks (video)", "TEDTalks: Tod Machover, Dan Ellsey (2008)"],
850
+ ["TED", "TEDTalks (video)", "TEDTalks: Yochai Benkler (2005)"],
851
+ ["The Police", "Message In A Box: The Complete Recordings (Disc 3)", "A Kind Of Loving"],
852
+ ["Virginia Postrel", "TEDTalks (video)", "TEDTalks : The power of glamour - Virginia Postrel (2004)"],
853
+ ["Wade Davis", "TEDTalks (video)", "TEDTalks : The worldwide web of belief and ritual - Wade Davis (2008)"],
854
+ ["Wumpscut", "The Mesner Tracks", "Ceremony (Remastered)"],
855
+ ["Wumpscut", "The Mesner Tracks", "Cry Weisenstein Cry (Mad Mix)"]
856
+ ]
857
+ assert_equal expected, actual
858
+ end
859
+
860
+ def test_bitrate_histogram
861
+ actual = @grok.bitrate_histogram
862
+ expected = [
863
+ ["1", 56],
864
+ ["1", 64],
865
+ ["1", 81],
866
+ ["2", 90],
867
+ ["2", 91],
868
+ ["6", 92],
869
+ ["7", 93],
870
+ ["20", 94],
871
+ ["6", 95],
872
+ ["19", 96],
873
+ ["10", 97],
874
+ ["26", 98],
875
+ ["43", 99],
876
+ ["77", 100],
877
+ ["79", 101],
878
+ ["37", 102],
879
+ ["24", 103],
880
+ ["7", 104],
881
+ ["1", 112],
882
+ ["1", 115],
883
+ ["1", 119],
884
+ ["1", 120],
885
+ ["3", 121],
886
+ ["2", 122],
887
+ ["3", 123],
888
+ ["7", 124],
889
+ ["20", 125],
890
+ ["11", 126],
891
+ ["5", 127],
892
+ ["3678", 128],
893
+ ["9", 129],
894
+ ["2", 130],
895
+ ["128", 160],
896
+ ["5", 192],
897
+ ["1", 256],
898
+ ["2", 320]
899
+ ]
900
+ assert_equal expected, actual
901
+ end
902
+
903
+ def test_missing_track_numbers
904
+ actual = @grok.missing_track_numbers
905
+ expected = [
906
+ ["", "", "LetsPoledance"],
907
+ ["", "", "MadonnavsmixmastermacMusic"],
908
+ ["", "", "Ryan Davis Vs Marthin Luter King [ Strano Mash Up ]"],
909
+ ["", "", "Whotolddre"],
910
+ ["Brazilian Girls", "Brazilian Girls Remix EP", "Crosseyed And Painless"],
911
+ ["Crowded House vs Snoop Dogg", "", "Return Of The Weather Episode (remix) (Go Home Productions)"],
912
+ ["DJ BC", "", "MilkShookMe"],
913
+ ["DJ Te\303\253po", "", "Taint It"],
914
+ ["Eminem vs Prodigy", "", "Superman (Asnivor Remix) (Breathe Mix)"],
915
+ ["Go Home Productions", "", "Annie's Stoned Rush"],
916
+ ["Go Home Productions", "", "David X"],
917
+ ["Go Home Productions", "", "Notorious Trick"],
918
+ ["Immortal Technique", "", "Bin Laden feat. Mos Def"],
919
+ ["Kevin MacLeod", "Royalty Free 2008", "Serpentine Trek"],
920
+ ["King Black Acid", "Mothman Prophecies", "The Other Voice"],
921
+ ["Mos Def", "", "Dollar Day for New Orleans ... Katrina Klap"],
922
+ ["The Legendary K.O.", "", "George Bush Doesn't Care About Black People"],
923
+ ["dINbOT", "www.dinbot.com", "Bathroom Grammar (English Beat vs Nelly)"],
924
+ ["dINbOT", "www.dinbot.com", "Beastie Bop (Ramones vs Beastie Boys)"],
925
+ ["dINbOT", "www.dinbot.com", "Gay Paranoia (Black Sabbath vs Electric 6)"],
926
+ ["dINbOT", "www.dinbot.com", "Hell On Wheelz (Thrill Kill Kult vs. No Doubt)"],
927
+ ["dINbOT", "www.dinbot.com", "Paintin' Paintin' (Rolling Stones vs Destiny's Child)"],
928
+ ["dINbOT", "www.dinbot.com", "Tom's Penis (King Missile vs. Suzanne Vega)"],
929
+ ["dINbOT", "www.dinbot.com", "Whipsta (Devo vs. 50 Cent)"],
930
+ ["dINbOT", "www.dinbot.com", "World of Flesh (One Inch Punch vs Morcheeba)"],
931
+ ["smash@mash-ups.co.uk", "", "Wild Rock Music!"]
932
+ ]
933
+ assert_equal expected, actual
934
+ end
935
+
936
+ def test_missing_genre
937
+ actual = @grok.missing_genre
938
+ expected = [
939
+ ["", "", "Ryan Davis Vs Marthin Luter King [ Strano Mash Up ]"],
940
+ ["Immortal Technique", "", "Bin Laden feat. Mos Def"],
941
+ ["King Black Acid", "Mothman Prophecies", "The Other Voice"],
942
+ ["Mos Def", "", "Dollar Day for New Orleans ... Katrina Klap"]
943
+ ]
944
+ assert_equal expected, actual
945
+ end
946
+
947
+ def test_disk_pigs
948
+ actual = @grok.disk_pigs
949
+ expected = [
950
+ [336141872, "Apple Developer Connection", "iPhone Getting Started Videos", "Fundamentals of Cocoa Session from WWDC"],
951
+ [111450131, "Peter Hirshberg", "TEDTalks (video)", "TEDTalks : The Web and TV, a sibling rivalry - Peter Hirshberg (2007)"],
952
+ [92263281, "TED", "TEDTalks (video)", "TEDTalks: Neil Turok (2008)"],
953
+ [89178761, "TED", "TEDTalks (video)", "TEDTalks : Larry Brilliant (2006) video"],
954
+ [87557094, "Jane Goodall", "TEDTalks (video)", "TEDTalks : Helping humans and animals live together in Africa - Jane Goodall (2007)"],
955
+ [86808084, "Freeman Dyson", "TEDTalks (video)", "TEDTalks : Let's look for life in the outer solar system - Freeman Dyson (2003)"],
956
+ [84714891, "Rodney Brooks", "TEDTalks (video)", "TEDTalks : How robots will invade our lives - Rodney Brooks (2003)"],
957
+ [81551137, "Stewart Brand", "TEDTalks (video)", "TEDTalks : Building a home for the Clock of the Long Now - Stewart Brand (2004)"],
958
+ [79665218, "TED", "TEDTalks (video)", "TEDTalks: Karen Armstrong (2008)"],
959
+ [76916661, "Spencer Wells", "TEDTalks (video)", "TEDTalks : Building a family tree for all humanity - Spencer Wells (2007)"]
960
+ ]
961
+ assert_equal expected, actual
962
+ end
963
+
964
+ def test_dj_itis_skip_happy
965
+ actual = @grok.dj_itis_skip_happy
966
+ expected = [
967
+ ["Alphaville", "Afternoons In Utopia", "Carol Masters", 1, 1],
968
+ ["Pigface", "Truth Will Out", "Do No Wrong", 1, 1],
969
+ ["Moby", "Rare: The Collected B-Sides (1989-1993)", "Thousand", 2, 2],
970
+ ["Tony Scott", "Music for Zen Meditation and Other Joys", "The Murmuring Sound Of The Mountain Stream", 3, 2]
971
+ ]
972
+ assert_equal expected, actual
973
+ end
974
+
975
+ def test_screaming_names
976
+ actual = @grok.screaming_names
977
+ expected = [
978
+ ["TV II", "Ministry", "Psalm 69"],
979
+ ["M", "The Cure", "Seventeen Seconds"],
980
+ ["E", "Sigur R\303\263s", "Agaetis Byrjun"],
981
+ ["VIT", "The Future Sound Of London", "Lifeforms (Disc 2)"],
982
+ ["GNMI", "Hitting Birth", "Kiss of the Last Three Years"],
983
+ ["ALL", "Descendents", "ALL"]
984
+ ]
985
+ assert_equal expected, actual
986
+ end
987
+
988
+ def test_treemap_bitrate
989
+ actual = @grok.treemap_bitrate
990
+ expected = 14990
991
+ assert_equal expected, actual
992
+ end
993
+
994
+ def test_genre_histogram
995
+ actual = @grok.genre_histogram
996
+ expected = [
997
+ ["1433", "Alternative"],
998
+ ["727", "Goth"],
999
+ ["640", "Electronic"],
1000
+ ["525", "Industrial"],
1001
+ ["407", "Rock"],
1002
+ ["222", "Punk"],
1003
+ ["67", "World"],
1004
+ ["60", "Podcast"],
1005
+ ["40", "Soundtrack"],
1006
+ ["38", "New Age"],
1007
+ ["36", "Mashup"],
1008
+ ["32", "Hip-Hop/Rap"],
1009
+ ["9", "Blues"],
1010
+ ["4", ""],
1011
+ ["4", "Classical"],
1012
+ ["2", "Comedy"],
1013
+ ["1", "R&#38;B/Soul"],
1014
+ ["1", "Video"]
1015
+ ]
1016
+ assert_equal expected, actual
1017
+ end
1018
+
1019
+ def test_treemap_genre
1020
+ actual = @grok.treemap_genre
1021
+ expected = 7972
1022
+ assert_equal expected, actual
1023
+ end
1024
+ end