2014-11-19 09:08:38 -05:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#include <core/tags/track.h>
|
|
|
|
#include <tests/test.h>
|
|
|
|
|
2014-11-20 08:22:50 -05:00
|
|
|
static void test_track_tag_default()
|
2014-11-19 09:08:38 -05:00
|
|
|
{
|
|
|
|
Track track;
|
|
|
|
|
2014-11-21 08:11:03 -05:00
|
|
|
test_equal(track.album(), (Album *)NULL);
|
2014-11-20 08:41:18 -05:00
|
|
|
test_equal(track.artist(), (Artist *)NULL);
|
2014-11-21 08:25:35 -05:00
|
|
|
test_equal(track.genre(), (Genre *)NULL);
|
2014-11-20 08:16:13 -05:00
|
|
|
test_equal(track.library(), (Library *)NULL);
|
2014-11-19 09:08:38 -05:00
|
|
|
|
|
|
|
test_equal(track.name(), (std::string)"");
|
|
|
|
test_equal(track.lowercase(), (std::string)"");
|
|
|
|
test_equal(track.primary_key(), (std::string)"");
|
|
|
|
test_equal(track.filepath, (std::string)"");
|
|
|
|
test_equal(track.length_str, (std::string)"");
|
|
|
|
|
2014-11-24 08:38:19 -05:00
|
|
|
test_equal(track.track(), (unsigned)0);
|
2014-11-24 16:25:50 -05:00
|
|
|
test_equal(track.length(), (unsigned)0);
|
2014-11-24 08:39:32 -05:00
|
|
|
test_equal(track.count(), (unsigned)0);
|
2014-11-19 09:08:38 -05:00
|
|
|
test_equal(track.last_year, (unsigned)0);
|
|
|
|
test_equal(track.last_month, (unsigned)0);
|
|
|
|
test_equal(track.last_day, (unsigned)0);
|
|
|
|
}
|
|
|
|
|
2014-11-20 08:22:50 -05:00
|
|
|
static void test_track_tag_constructor()
|
|
|
|
{
|
2014-11-21 08:11:03 -05:00
|
|
|
Album *album = tags :: get_album("Hyrule Symphony", 1998);
|
2014-11-20 08:41:18 -05:00
|
|
|
Artist *artist = tags :: get_artist("Koji Kondo");
|
2014-11-21 08:25:35 -05:00
|
|
|
Genre *genre = tags :: get_genre("Video Game Music");
|
2014-11-20 08:22:50 -05:00
|
|
|
Library *library = tags :: get_library("/home/Zelda/Music");
|
2014-11-26 08:23:20 -05:00
|
|
|
Track track(album, artist, genre, library, "Legend of Zelda Medley", 288, 13);
|
2014-11-20 08:22:50 -05:00
|
|
|
|
2014-11-21 08:11:03 -05:00
|
|
|
test_equal(track.album(), album);
|
2014-11-20 08:41:18 -05:00
|
|
|
test_equal(track.artist(), artist);
|
2014-11-21 08:25:35 -05:00
|
|
|
test_equal(track.genre(), genre);
|
2014-11-20 08:22:50 -05:00
|
|
|
test_equal(track.library(), library);
|
2014-11-21 08:36:49 -05:00
|
|
|
test_equal(library->size(), (unsigned)1);
|
2014-11-24 08:38:19 -05:00
|
|
|
|
2014-11-26 08:23:20 -05:00
|
|
|
test_equal(track.name(), (std::string)"Legend of Zelda Medley");
|
|
|
|
test_equal(track.lowercase(), (std::string)"legend of zelda medley");
|
|
|
|
|
2014-11-24 16:25:50 -05:00
|
|
|
test_equal(track.track(), (unsigned)13);
|
|
|
|
test_equal(track.length(), (unsigned)288);
|
|
|
|
test_equal(track.count(), (unsigned)0);
|
2014-11-21 08:36:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_track_tag_destructor()
|
|
|
|
{
|
|
|
|
Library *library = tags :: get_library("/home/Zelda/Music");
|
|
|
|
test_equal(library->size(), (unsigned)0);
|
2014-11-20 08:22:50 -05:00
|
|
|
}
|
|
|
|
|
2014-11-19 09:08:38 -05:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2014-11-20 08:22:50 -05:00
|
|
|
run_test("Track Tag Default Constructor Test", test_track_tag_default);
|
|
|
|
run_test("Track Tag Constructor Test", test_track_tag_constructor);
|
2014-11-21 08:36:49 -05:00
|
|
|
run_test("Track Tag Destructor Test", test_track_tag_destructor);
|
2014-11-19 09:08:38 -05:00
|
|
|
return 0;
|
|
|
|
}
|