blob: 418a36c7bce4a23de33068e7c39fc8fa4b807d12 (
plain)
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
|
#include "turns/domain/participant.hpp"
#include "turns/domain/turn_order.hpp"
#include <catch2/catch_test_macros.hpp>
#include <giomm/liststore.h>
namespace turns::domain::tests
{
/**
* Bug description:
*
* After having stepped according to the step pattern below, tt was possible to step backward often enough to underflow the round number:
* - forward
* - backward
* - forward
*/
SCENARIO("Can step back infinitely", "[turn_order][bug]")
{
GIVEN("a non-empty turn_order")
{
auto instance = turn_order::create();
instance->add("A", 0, disposition::neutral);
WHEN("it is started and then stepped forward, backward, forward")
{
instance->start();
instance->next();
instance->previous();
instance->next();
THEN("it is not possible to step backwards more than once")
{
instance->previous();
instance->previous();
REQUIRE(instance->round_number() == 0);
}
}
}
}
} // namespace turns::domain::tests
|