43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
/**
|
|
* @file
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
*/
|
|
#include <core/tags/album.h>
|
|
#include <tests/test.h>
|
|
|
|
static void test_album_tag()
|
|
{
|
|
Album album("Hyrule Symphony", 1998);
|
|
File f("album_tag", 0);
|
|
|
|
test_equal(album.name(), (std::string)"Hyrule Symphony");
|
|
test_equal(album.lowercase(), (std::string)"hyrule symphony");
|
|
test_equal(album.year(), (unsigned int)1998);
|
|
test_equal(album.primary_key(), (std::string)"1998/Hyrule Symphony");
|
|
|
|
f.open(OPEN_WRITE);
|
|
album.write(f);
|
|
f.close();
|
|
|
|
album = Album();
|
|
test_equal(album.name(), (std::string)"");
|
|
test_equal(album.lowercase(), (std::string)"");
|
|
test_equal(album.year(), (unsigned int)0);
|
|
test_equal(album.primary_key(), (std::string)"0/");
|
|
|
|
f.open(OPEN_READ);
|
|
album.read(f);
|
|
f.close();
|
|
|
|
test_equal(album.name(), (std::string)"Hyrule Symphony");
|
|
test_equal(album.lowercase(), (std::string)"hyrule symphony");
|
|
test_equal(album.year(), (unsigned int)1998);
|
|
test_equal(album.primary_key(), (std::string)"1998/Hyrule Symphony");
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
run_test("Album Tag Test", test_album_tag);
|
|
return 0;
|
|
}
|