Use C++11 std::move for swap in selection sort algorithm
[purplehaze.git] / test / unit / test_piece.cpp
blob3f2dc23daa240d0944de93d5b8555b78ebd4ab1b
1 #include "../../src/piece.h"
2 #include "gtest/gtest.h"
4 TEST(PieceTest, Constructor)
6 for (const Color &c : COLORS) {
7 for (const PieceType &t : PIECE_TYPES) {
8 for (int i = 0; i < 9; ++i) {
9 Piece p(c, t, i);
11 // Test getters
12 EXPECT_EQ(c, p.get_color());
13 EXPECT_EQ(t, p.get_type());
14 EXPECT_EQ(i, p.get_index());
16 // Test comparison operators
17 for (const Color &c2 : COLORS) {
18 for (const PieceType &t2 : PIECE_TYPES) {
19 for (int j = 0; j < 9; ++j) {
20 Piece p2(c2, t2, j);
21 if (c == c2 && t == t2 && i == j) {
22 EXPECT_EQ(p2, p);
23 } else {
24 EXPECT_NE(p2, p);
34 TEST(PieceTest, Size)
36 EXPECT_EQ(sizeof(unsigned char), sizeof(Piece));