1dcbc0c505
We can just use the db_size variable directly. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
/**
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
*/
|
|
#include <core/tags/artist.h>
|
|
#include "../test.h"
|
|
|
|
static void test_artist_tag()
|
|
{
|
|
Artist artist;
|
|
test_equal(artist.name(), (std::string)"");
|
|
test_equal(artist.lowercase(), (std::string)"");
|
|
test_equal(artist.primary_key(), (std::string)"");
|
|
|
|
artist = 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");
|
|
}
|
|
|
|
static void test_artist_tag_lookup()
|
|
{
|
|
database<Artist> artist_db("artist.db", false);
|
|
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);
|
|
|
|
artist_db.load();
|
|
test_equal(artist_db.db_size, (unsigned)1);
|
|
}
|
|
|
|
DECLARE_UNIT_TESTS(
|
|
UNIT_TEST("Artist Tag", test_artist_tag),
|
|
UNIT_TEST("Artist Tag Lookup", test_artist_tag_lookup),
|
|
);
|