-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
First add test lib gtest using cpm. The create a test/ dir. then add a sample:
#include "Player.hpp"
#include <gtest/gtest.h>
TEST(PlayerTests, CaptureEnemyWith_Success) {
chk::Player player(chk::PlayerType::PLAYER_RED);
// Mock or create a Piece and add it to player
// Assuming you have a method to add mock pieces
chk::PiecePtr piece = std::make_unique<chk::Piece>(1); // Mock piece
player.receivePiece(piece);
// Test capturing
sf::Vector2f destination(1.0f, 2.0f);
EXPECT_TRUE(player.captureEnemyWith(1, destination));
}
TEST(PlayerTests, LosePiece_RemovesPieceFromBasket) {
chk::Player player(chk::PlayerType::PLAYER_RED);
chk::PiecePtr piece = std::make_unique<chk::Piece>(1); // Mock piece
player.receivePiece(piece);
player.losePiece(1);
EXPECT_FALSE(player.hasThisPiece(1));
}
Metadata
Metadata
Assignees
Labels
No labels