2014-11-08 13:43:23 -05:00
|
|
|
/**
|
|
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#include <core/tags/artist.h>
|
2015-08-27 10:57:29 -04:00
|
|
|
#include "../test.h"
|
2014-11-08 13:43:23 -05:00
|
|
|
|
|
|
|
static void test_artist_tag()
|
|
|
|
{
|
|
|
|
Artist artist;
|
2014-11-08 20:08:42 -05:00
|
|
|
test_equal(artist.name(), (std::string)"");
|
|
|
|
test_equal(artist.lowercase(), (std::string)"");
|
2014-11-08 13:43:23 -05:00
|
|
|
test_equal(artist.primary_key(), (std::string)"");
|
|
|
|
|
|
|
|
artist = Artist("Koji Kondo");
|
2014-11-08 20:08:42 -05:00
|
|
|
test_equal(artist.name(), (std::string)"Koji Kondo");
|
|
|
|
test_equal(artist.lowercase(), (std::string)"koji kondo");
|
2014-11-08 13:43:23 -05:00
|
|
|
test_equal(artist.primary_key(), (std::string)"Koji Kondo");
|
|
|
|
}
|
|
|
|
|
2014-11-16 10:08:12 -05:00
|
|
|
static void test_artist_tag_lookup()
|
|
|
|
{
|
2015-10-17 10:07:58 -04:00
|
|
|
database<Artist> artist_db("artist.db", false);
|
2014-11-16 10:08:12 -05:00
|
|
|
Artist *artist = tags :: get_artist("Koji Kondo");
|
|
|
|
|
|
|
|
test_equal(artist->name(), (std::string)"Koji Kondo");
|
|
|
|
test_equal(artist->lowercase(), (std::string)"koji kondo");
|
|
|
|
test_equal(artist->primary_key(), (std::string)"Koji Kondo");
|
|
|
|
|
|
|
|
test_equal(tags :: get_artist("Koji Kondo"), artist);
|
|
|
|
test_equal(tags :: get_artist(0), artist);
|
|
|
|
test_equal(tags :: get_artist(1), (Artist *)NULL);
|
|
|
|
|
2015-09-17 08:12:25 -04:00
|
|
|
db_load(&artist_db);
|
2015-10-17 14:59:06 -04:00
|
|
|
test_equal(artist_db.db_size, (unsigned)1);
|
2014-11-16 10:08:12 -05:00
|
|
|
}
|
|
|
|
|
2015-08-27 10:57:29 -04:00
|
|
|
DECLARE_UNIT_TESTS(
|
|
|
|
UNIT_TEST("Artist Tag", test_artist_tag),
|
|
|
|
UNIT_TEST("Artist Tag Lookup", test_artist_tag_lookup),
|
|
|
|
);
|