66 lines
1.4 KiB
C++
66 lines
1.4 KiB
C++
|
//
|
||
|
// Created by trotfunky on 25/04/19.
|
||
|
//
|
||
|
|
||
|
|
||
|
#include <gtest/gtest.h>
|
||
|
#include <vector>
|
||
|
#include "Coinche.h"
|
||
|
|
||
|
TEST(testCoinche,testValeursAtout)
|
||
|
{
|
||
|
std::vector<card> deck = generate_cards();
|
||
|
|
||
|
Couleur atout = pick_atout();
|
||
|
|
||
|
std::vector<card> jeu;
|
||
|
|
||
|
update_values(atout,deck,jeu);
|
||
|
|
||
|
for(card carte : deck)
|
||
|
{
|
||
|
if(carte.force == Force::valet && carte.couleur == atout)
|
||
|
{
|
||
|
ASSERT_EQ(carte.value,20);
|
||
|
}
|
||
|
if(carte.force == Force::neuf && carte.couleur == atout)
|
||
|
{
|
||
|
ASSERT_EQ(carte.value,14);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
TEST(testCoinche,testCarte)
|
||
|
{
|
||
|
card carte1{};
|
||
|
carte1.couleur = Couleur::carreau;
|
||
|
carte1.force = Force::neuf;
|
||
|
carte1.value = 0;
|
||
|
|
||
|
card carte2{};
|
||
|
carte2.couleur = Couleur::coeur;
|
||
|
carte2.force = Force::dix;
|
||
|
carte2.value = 10;
|
||
|
|
||
|
ASSERT_FALSE(WonOrLost(carte1,carte2,Couleur::pique));
|
||
|
ASSERT_TRUE(WonOrLost(carte1,carte2,Couleur::coeur));
|
||
|
|
||
|
carte2.couleur = Couleur::carreau;
|
||
|
|
||
|
ASSERT_TRUE(WonOrLost(carte1,carte2,Couleur::carreau));
|
||
|
|
||
|
carte2.force = Force::huit;
|
||
|
carte2.value = 0;
|
||
|
|
||
|
ASSERT_FALSE(WonOrLost(carte1,carte2,Couleur::carreau));
|
||
|
|
||
|
carte2.force = Force::valet;
|
||
|
carte2.value = 1;
|
||
|
|
||
|
ASSERT_TRUE(WonOrLost(carte1,carte2,Couleur::carreau));
|
||
|
}
|
||
|
|
||
|
int main(int argc, char **argv) {
|
||
|
::testing::InitGoogleTest(&argc, argv);
|
||
|
return RUN_ALL_TESTS();
|
||
|
}
|