ocarina/tests/core/tags/library.cpp

42 lines
915 B
C++

/**
* @file
* Copyright 2014 (c) Anna Schumaker.
*/
#include <core/tags/library.h>
#include <tests/test.h>
static void test_library_tag()
{
Library library("/home/Zelda/Music");
File f("library_tag", 0);
test_equal(library.primary_key(), (std::string)"/home/Zelda/Music");
test_equal(library.count, (unsigned)0);
test_equal(library.enabled(), true);
library.count = 42; /* not saved to disk */
f.open(OPEN_WRITE);
library.write(f);
f.close();
library = Library();
test_equal(library.primary_key(), (std::string)"");
test_equal(library.count, (unsigned)0);
test_equal(library.enabled(), false);
f.open(OPEN_READ);
library.read(f);
f.close();
test_equal(library.primary_key(), (std::string)"/home/Zelda/Music");
test_equal(library.count, (unsigned)0);
test_equal(library.enabled(), true);
}
int main(int argc, char **argv)
{
run_test("Library Tag Test", test_library_tag);
return 0;
}