<commit_before>#include "search.h"
#include "catch.hpp"
#include "board.h"

TEST_CASE("Search works as expected") {
  PSquareTable::init();
  ZKey::init();

  SECTION("Search works as expected after PSquareTable and ZKey are initialized") {
    Board board;

    SECTION("Search finds a checkmate on next move") {
      // Fool's mate
      board.setToFen("rnbqkbnr/pppp1ppp/4p3/8/6P1/5P2/PPPPP2P/RNBQKBNR b KQkq -");

      Search search(board, 5000, 2, false);

      REQUIRE(search.getBestMove().getNotation() == "d8h4");
    }

    SECTION("Search returns the only legal move when checkmate is 1 move away") {
      board.setToFen("r4rk1/ppp2ppp/4p3/8/4p3/4PPbP/PPPB2q1/R2QKR2 w - -");

      Search search(board, 5000, 2, false);

      REQUIRE(search.getBestMove().getNotation() == "f1f2");
    }
  }
}<commit_msg>Add more search tests<commit_after>#include "search.h"
#include "catch.hpp"
#include "board.h"

TEST_CASE("Search works as expected") {
  PSquareTable::init();
  ZKey::init();

  SECTION("Search works as expected after PSquareTable and ZKey are initialized") {
    Board board;

    SECTION("Search finds a checkmate on next move") {
      // Fool's mate
      board.setToFen("rnbqkbnr/pppp1ppp/4p3/8/6P1/5P2/PPPPP2P/RNBQKBNR b KQkq -");

      Search search(board, 5000, 2, false);

      REQUIRE(search.getBestMove().getNotation() == "d8h4");
    }

    SECTION("Search returns the only legal move when checkmate is 1 move away") {
      board.setToFen("r4rk1/ppp2ppp/4p3/8/4p3/4PPbP/PPPB2q1/R2QKR2 w - -");

      Search search(board, 5000, 2, false);

      REQUIRE(search.getBestMove().getNotation() == "f1f2");
    }

    SECTION("Search recognizes when a check can be made to capture a queen") {
      board.setToFen("8/4N3/8/1k5q/8/8/8/2K2R2 w - -");

      Search search(board, 3, 5000, false);

      REQUIRE(search.getBestMove().getNotation() == "f1f5");
    }
  }
}
{'fraction_non_alphanumeric': 0.14760147601476015, 'fraction_numerical': 0.04902477596204533, 'mean_word_length': 3.34324942791762, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2806379', 'n_tokens_mistral': 781, 'n_tokens_neox': 721, 'n_words': 152}