Skip to content

Commit 23f293a

Browse files
committed
More debug assertions
1 parent 7f7d1d5 commit 23f293a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/games/game.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,8 @@ class GameRep : public std::enable_shared_from_this<GameRep> {
967967
virtual void BuildComputedValues() const {}
968968
};
969969

970+
#include <assert.h>
971+
970972
class GameRep::Infosets {
971973
public:
972974
class iterator {
@@ -993,10 +995,29 @@ class GameRep::Infosets {
993995

994996
value_type operator*() const
995997
{
998+
assert(inner_ != inner_end_);
999+
assert(*inner_);
1000+
assert((*inner_)->IsValid());
1001+
assert((*inner_)->m_game != nullptr);
1002+
assert((*inner_)->m_player != nullptr);
1003+
1004+
auto g = (*inner_)->GetGame();
1005+
assert(g); // i.e. g != nullptr
9961006
return GameInfoset(*inner_); // GameObjectPtr constructor
9971007
}
9981008

999-
value_type operator->() const { return GameInfoset(*inner_); }
1009+
value_type operator->() const
1010+
{
1011+
assert(inner_ != inner_end_);
1012+
assert(*inner_);
1013+
assert((*inner_)->IsValid());
1014+
assert((*inner_)->m_game != nullptr);
1015+
assert((*inner_)->m_player != nullptr);
1016+
1017+
auto g = (*inner_)->GetGame();
1018+
assert(g); // i.e. g != nullptrreturn
1019+
return GameInfoset(*inner_);
1020+
}
10001021

10011022
iterator &operator++()
10021023
{

0 commit comments

Comments
 (0)