File: chesslegalitytest.h

package info (click to toggle)
tagua 1.0~alpha2-15
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 8,028 kB
  • ctags: 7,178
  • sloc: cpp: 26,149; ansic: 13,039; makefile: 182; ruby: 87; sh: 39
file content (64 lines) | stat: -rw-r--r-- 1,673 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef CHESSGAMESTATETEST_H
#define CHESSGAMESTATETEST_H

#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestCaller.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestFixture.h>
#include <cppunit/TestAssert.h>

#include "hlvariant/customboard.h"

// forward decl
namespace HLVariant { 
  template <typename Piece> class Board;
  
  namespace Chess { 
    template <typename Board, typename Move> class GameState; 
    template <typename State> class LegalityCheck;
    class Move;
    class Piece;
  }
}

typedef HLVariant::Chess::Move ChessMove;
typedef HLVariant::Chess::Piece ChessPiece;
typedef HLVariant::CustomBoard<8, 8, ChessPiece> Chessboard;
typedef HLVariant::Chess::GameState<Chessboard, ChessMove> ChessGameState;
typedef HLVariant::Chess::LegalityCheck<ChessGameState> ChessLegalityCheck;

class ChessLegalityTest : public CppUnit::TestFixture {
  CPPUNIT_TEST_SUITE(ChessLegalityTest);
  CPPUNIT_TEST(test_movements);
  CPPUNIT_TEST(test_pseudolegal);
  CPPUNIT_TEST(test_simple_move);
  CPPUNIT_TEST(test_promotion);
  CPPUNIT_TEST(test_en_passant);
  CPPUNIT_TEST(test_castling);
  CPPUNIT_TEST(test_attack1);
  CPPUNIT_TEST(test_attack2);
  CPPUNIT_TEST(test_attack3);
  CPPUNIT_TEST(test_attack4);
  CPPUNIT_TEST_SUITE_END();
private:
  ChessGameState* m_state;
  ChessLegalityCheck* m_legality_check;
public:
  void setUp();
  void tearDown();
  
  void test_movements();
  void test_pseudolegal();
  void test_simple_move();
  void test_promotion();
  void test_en_passant();
  void test_castling();
  void test_attack1();
  void test_attack2();
  void test_attack3();
  void test_attack4();
};

#endif // CHESSGAMESTATETEST_H