|
From: Markus R. <god...@us...> - 2009-11-12 12:49:47
|
Module: performous
Branch: master
Commit: f00652f3e152bd331356bfcc369b1bd7e2e5ac1a
Author: Markus Raab <un...@ma...>
Date: Wed Nov 11 16:12:23 2009 +0100
test case added
---
game/database.cc | 14 ++++++++++++--
game/database.hh | 2 ++
game/players.hh | 2 ++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/game/database.cc b/game/database.cc
index c8d67b6..305aeda 100644
--- a/game/database.cc
+++ b/game/database.cc
@@ -76,13 +76,23 @@ void Database::addHiscore (boost::shared_ptr<Song> s) {
m_hiscores.addHiscore(score, playerid, songid);
}
-// Test program for Database
-int main() {
+int test() {
Database d("database.xml");
d.addPlayer("Markus", "m.jpg");
boost::shared_ptr<Song> s(new Song("/usr/share/songs/ABBA/ABBA - Dancing Queen/", "ABBA - Dancing Queen.txt"));
d.addSong(s);
+ PlayerItem pi;
+ pi.name = "Markus";
+ d.m_players.m_filtered.push_back(pi);
+ d.m_players.scores.push_back(5000);
+
d.addHiscore(s);
+
+ return 0;
+}
+
+int main() {
+ return test();
}
diff --git a/game/database.hh b/game/database.hh
index 851e856..714234a 100644
--- a/game/database.hh
+++ b/game/database.hh
@@ -38,6 +38,8 @@ class Database
void addSong (boost::shared_ptr<Song> s);
void addHiscore (boost::shared_ptr<Song> s);
+ friend int test();
+
private:
fs::path m_filename;
diff --git a/game/players.hh b/game/players.hh
index b035926..3dff279 100644
--- a/game/players.hh
+++ b/game/players.hh
@@ -54,6 +54,8 @@ class Players: boost::noncopyable {
bool m_dirty;
+ friend int test();
+
public:
cur_players_t cur;
cur_scores_t scores;
|