#include <gmock/gmock.h>

using ::testing::ElementsAre;

#include "population/selection/Selection.h"

using namespace aevol;

TEST(SelectionTest, local_index_to_offset) {
  EXPECT_THAT(local_index_to_offset(0, 3), ElementsAre(-1, -1));
  EXPECT_THAT(local_index_to_offset(3, 3), ElementsAre(0, -1));
  EXPECT_THAT(local_index_to_offset(4, 3), ElementsAre(0, 0));
  EXPECT_THAT(local_index_to_offset(7, 3), ElementsAre(1, 0));

  EXPECT_THAT(local_index_to_offset(0, 5), ElementsAre(-2, -2));
  EXPECT_THAT(local_index_to_offset(5, 5), ElementsAre(-1, -2));
  EXPECT_THAT(local_index_to_offset(12, 5), ElementsAre(0, 0));
  EXPECT_THAT(local_index_to_offset(16, 5), ElementsAre(1, -1));
}
