Skip to content

Commit

Permalink
refactor: move time utility into time dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Disservin committed Oct 2, 2024
1 parent 1350fc3 commit 26b3397
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ SRC_FILES := \
$(SRCDIR)/matchmaking/tournament/roundrobin/roundrobin.cpp \
$(SRCDIR)/matchmaking/tournament/tournament_manager.cpp \
$(SRCDIR)/pgn/pgn_builder.cpp \
$(SRCDIR)/time/timecontrol.cpp \
$(SRCDIR)/timecontrol/timecontrol.cpp \
$(SRCDIR)/util/logger/logger.cpp \
$(SRCDIR)/printing/printing.cpp \
$(SRCDIR)/main.cpp
Expand Down
2 changes: 1 addition & 1 deletion app/src/matchmaking/match/match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <algorithm>

#include <time/time.hpp>
#include <types/tournament.hpp>
#include <util/date.hpp>
#include <util/helper.hpp>
#include <util/logger/logger.hpp>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/src/types/engine_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <tuple>
#include <vector>

#include <time/timecontrol.hpp>
#include <timecontrol/timecontrol.hpp>
#include <types/enums.hpp>
#include <util/helper.hpp>

Expand Down
2 changes: 1 addition & 1 deletion app/src/types/match_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include <chess.hpp>

#include <time/time.hpp>
#include <types/engine_config.hpp>
#include <util/date.hpp>
#include <util/game_pair.hpp>

namespace fastchess {
Expand Down
2 changes: 1 addition & 1 deletion app/src/util/logger/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <thread>
#include <variant>

#include <util/date.hpp>
#include <time/time.hpp>

#ifdef USE_ZLIB
# include "../../../third_party/gzip/gzstream.h"
Expand Down
2 changes: 1 addition & 1 deletion app/src/util/logger/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <thread>
#include <variant>

#include <util/date.hpp>
#include <time/time.hpp>

#define FMT_HEADER_ONLY
#include "../../../third_party/fmt/include/fmt/core.h"
Expand Down
11 changes: 5 additions & 6 deletions app/tests/timecontrol_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <time/timecontrol.hpp>
#include <timecontrol/timecontrol.hpp>

#include "doctest/doctest.hpp"

Expand All @@ -7,9 +7,9 @@ using namespace fastchess;
TEST_SUITE("TimeControl") {
TEST_CASE("moves/time+increment") {
TimeControl::Limits limits;
limits.moves = 3;
limits.time = 10000;
limits.increment = 100;
limits.moves = 3;
limits.time = 10000;
limits.increment = 100;
limits.timemargin = 100;

TimeControl tc(limits);
Expand Down Expand Up @@ -38,10 +38,9 @@ TEST_SUITE("TimeControl") {

TimeControl tc(limits);


CHECK(tc.updateTime(limits.fixed_time + limits.timemargin - 1) == true);
CHECK(tc.getTimeLeft() == limits.fixed_time);

CHECK(tc.updateTime(limits.fixed_time + limits.timemargin) == true);
CHECK(tc.getTimeLeft() == limits.fixed_time);

Expand Down

0 comments on commit 26b3397

Please sign in to comment.