test/chess_clock_test.cpp
TEST_F(ChessClockTester, ExtendTime_SearchToDepthX) {
/// UCI Options allocated time is < 10 seconds, so time isn't extensible
    EXPECT_EQ(uci_options.search_to_depth_x, -1);
    EXPECT_EQ(uci_options.search_for_time_x, -1);
    uci_options.search_to_depth_x = 10;

    /// Test white and black
    cc.alloc_time(uci_options, WHITE);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.extend_time(9);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.alloc_time(uci_options, BLACK);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.extend_time(0);
    EXPECT_EQ(cc.allocated_time(), -1);

    /// UCI Options allocated time is < 10 seconds, so time isn't extensible
    uci_options.search_to_depth_x = 15;
    uci_options.w_time_milli = 100000;
    uci_options.b_time_milli = 100000;

    /// Test white and black
    cc.alloc_time(uci_options, WHITE);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.extend_time(1);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.alloc_time(uci_options, BLACK);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.extend_time(15);
    EXPECT_EQ(cc.allocated_time(), -1);
}
/**
 * Tests the extend_time(...) function if the UCI Options stipulate to search to a certain depth
 */
Tests the extend_time(...) function if the UCI Options stipulate to search to a certain depth
Tests the extend_time ( ... ) function if the UCI Options stipulate to search to a certain depth
TEST_F(ChessClockTester, ExtendTime_SearchToDepthX) {
    EXPECT_EQ(uci_options.search_to_depth_x, -1);
    EXPECT_EQ(uci_options.search_for_time_x, -1);
    uci_options.search_to_depth_x = 10;
    cc.alloc_time(uci_options, WHITE);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.extend_time(9);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.alloc_time(uci_options, BLACK);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.extend_time(0);
    EXPECT_EQ(cc.allocated_time(), -1);
    uci_options.search_to_depth_x = 15;
    uci_options.w_time_milli = 100000;
    uci_options.b_time_milli = 100000;
    cc.alloc_time(uci_options, WHITE);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.extend_time(1);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.alloc_time(uci_options, BLACK);
    EXPECT_EQ(cc.allocated_time(), -1);
    cc.extend_time(15);
    EXPECT_EQ(cc.allocated_time(), -1);
}
TEST_F ( ChessClockTester , ExtendTime_SearchToDepthX ) { EXPECT_EQ ( uci_options . search_to_depth_x , -1 ) ; EXPECT_EQ ( uci_options . search_for_time_x , -1 ) ; uci_options . search_to_depth_x = 10 ; cc . alloc_time ( uci_options , WHITE ) ; EXPECT_EQ ( cc . allocated_time ( ) , -1 ) ; cc . extend_time ( 9 ) ; EXPECT_EQ ( cc . allocated_time ( ) , -1 ) ; cc . alloc_time ( uci_options , BLACK ) ; EXPECT_EQ ( cc . allocated_time ( ) , -1 ) ; cc . extend_time ( 0 ) ; EXPECT_EQ ( cc . allocated_time ( ) , -1 ) ; uci_options . search_to_depth_x = 15 ; uci_options . w_time_milli = 100000 ; uci_options . b_time_milli = 100000 ; cc . alloc_time ( uci_options , WHITE ) ; EXPECT_EQ ( cc . allocated_time ( ) , -1 ) ; cc . extend_time ( 1 ) ; EXPECT_EQ ( cc . allocated_time ( ) , -1 ) ; cc . alloc_time ( uci_options , BLACK ) ; EXPECT_EQ ( cc . allocated_time ( ) , -1 ) ; cc . extend_time ( 15 ) ; EXPECT_EQ ( cc . allocated_time ( ) , -1 ) ; }
Tests the extend_time(...) function if the UCI Options stipulate to search to a certain depth
Tests the extend_time ( ... ) function if the UCI Options stipulate to search to a certain depth
/// UCI Options allocated time is < 10 seconds, so time isn't extensible /// Test white and black /// UCI Options allocated time is < 10 seconds, so time isn't extensible /// Test white and black