mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-11 12:54:10 -07:00
add deck hashing tests
This commit is contained in:
parent
2b690f8c87
commit
b6c5c5ea4c
5 changed files with 84 additions and 7 deletions
|
|
@ -3,22 +3,33 @@
|
|||
#include <QTextStream>
|
||||
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||
|
||||
void testEmpty(const QString &clipboard)
|
||||
DeckList getDeckList(const QString &clipboard)
|
||||
{
|
||||
QString cp(clipboard);
|
||||
DeckList deckList;
|
||||
QString cp(clipboard);
|
||||
QTextStream stream(&cp); // text stream requires local copy
|
||||
deckList.loadFromStream_Plain(stream, false);
|
||||
return deckList;
|
||||
}
|
||||
|
||||
void testEmpty(const QString &clipboard)
|
||||
{
|
||||
DeckList deckList = getDeckList(clipboard);
|
||||
|
||||
ASSERT_TRUE(deckList.getCardList().isEmpty());
|
||||
}
|
||||
|
||||
void testHash(const QString &clipboard, const std::string &hash)
|
||||
{
|
||||
DeckList deckList = getDeckList(clipboard);
|
||||
std::cout << deckList.writeToString_Native().toStdString() << std::endl;
|
||||
|
||||
ASSERT_EQ(deckList.getDeckHash().toStdString(), hash);
|
||||
}
|
||||
|
||||
void testDeck(const QString &clipboard, const Result &result)
|
||||
{
|
||||
QString cp(clipboard);
|
||||
DeckList deckList;
|
||||
QTextStream stream(&cp); // text stream requires local copy
|
||||
deckList.loadFromStream_Plain(stream, false);
|
||||
DeckList deckList = getDeckList(clipboard);
|
||||
|
||||
ASSERT_EQ(result.name, deckList.getName().toStdString());
|
||||
ASSERT_EQ(result.comments, deckList.getComments().toStdString());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue