ocarina/tests/core/tags/artist.cpp

42 lines
938 B
C++

/**
* @file
* Copyright 2014 (c) Anna Schumaker.
*/
#include <core/file.h>
#include <core/tags/artist.h>
#include <tests/test.h>
static void test_artist_tag()
{
Artist artist;
File f("artist_tag", 0);
test_equal(artist.name, (std::string)"");
test_equal(artist.lower, (std::string)"");
test_equal(artist.primary_key(), (std::string)"");
artist = Artist("Koji Kondo");
test_equal(artist.name, (std::string)"Koji Kondo");
test_equal(artist.lower, (std::string)"koji kondo");
test_equal(artist.primary_key(), (std::string)"Koji Kondo");
f.open(OPEN_WRITE);
artist.write(f);
f.close();
artist = Artist();
f.open(OPEN_READ);
artist.read(f);
f.close();
test_equal(artist.name, (std::string)"Koji Kondo");
test_equal(artist.lower, (std::string)"koji kondo");
test_equal(artist.primary_key(), (std::string)"Koji Kondo");
}
int main(int argc, char **argv)
{
run_test("Artist Tag Test", test_artist_tag);
return 0;
}