mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-22 01:25:10 -07:00
[Card] Add a Tag attribute to the card filter tree
This commit is contained in:
parent
d65d23ffce
commit
0ea0e231bf
5 changed files with 35 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "gtest/gtest.h"
|
||||
#include <libcockatrice/filters/filter_string.h>
|
||||
#include <libcockatrice/filters/filter_tree.h>
|
||||
#include <libcockatrice/interfaces/noop_card_preference_provider.h>
|
||||
#include <libcockatrice/interfaces/noop_card_set_priority_controller.h>
|
||||
|
||||
|
|
@ -160,6 +161,23 @@ TEST_F(CardQuery, TagQueryTreatsCommasAsPartOfTheSlug)
|
|||
ASSERT_FALSE(FilterString("tags:ramp,removal").check(tagged));
|
||||
}
|
||||
|
||||
TEST_F(CardQuery, FilterTreeTagAttribute)
|
||||
{
|
||||
const CardData tagged = taggedCard();
|
||||
|
||||
FilterTree matching;
|
||||
matching.termNode(CardFilter::AttrTag, CardFilter::TypeAnd, "ramp");
|
||||
ASSERT_TRUE(matching.acceptsCard(tagged, CardSearchLanguage{}));
|
||||
|
||||
FilterTree partial;
|
||||
partial.termNode(CardFilter::AttrTag, CardFilter::TypeAnd, "ram");
|
||||
ASSERT_FALSE(partial.acceptsCard(tagged, CardSearchLanguage{}));
|
||||
|
||||
FilterTree missing;
|
||||
missing.termNode(CardFilter::AttrTag, CardFilter::TypeAnd, "squirrel");
|
||||
ASSERT_FALSE(missing.acceptsCard(tagged, CardSearchLanguage{}));
|
||||
}
|
||||
|
||||
TEST_F(CardQuery, TagQueryFalseWhenCardHasNoTags)
|
||||
{
|
||||
ASSERT_FALSE(FilterString("tags:ramp").check(cat));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue