<commit_before>/*
 * Copyright (C) 2015 <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.dungeon.game;

import org.junit.Assert;
import org.junit.Test;

public class DirectionTest {

  @Test
  public void testInvert() throws Exception {
    Assert.assertEquals(Direction.UP, Direction.DOWN.invert());
    Assert.assertEquals(Direction.NORTH, Direction.SOUTH.invert());
    Assert.assertEquals(Direction.EAST, Direction.WEST.invert());
    Assert.assertEquals(Direction.DOWN, Direction.UP.invert());
    Assert.assertEquals(Direction.SOUTH, Direction.NORTH.invert());
    Assert.assertEquals(Direction.WEST, Direction.EAST.invert());
  }

  @Test
  public void testDoubleInvert() throws Exception {
    for (Direction direction : Direction.values()) {
      Assert.assertEquals(direction, direction.invert().invert());
    }
  }

}<commit_msg>Wrote Direction.getAllExcept() tests.<commit_after>/*
 * Copyright (C) 2015 <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.dungeon.game;

import org.junit.Assert;
import org.junit.Test;

import java.util.Arrays;
import java.util.Collection;

public class DirectionTest {

  @Test
  public void invertShouldCorrectlyInvertTheDirection() throws Exception {
    Assert.assertEquals(Direction.UP, Direction.DOWN.invert());
    Assert.assertEquals(Direction.NORTH, Direction.SOUTH.invert());
    Assert.assertEquals(Direction.EAST, Direction.WEST.invert());
    Assert.assertEquals(Direction.DOWN, Direction.UP.invert());
    Assert.assertEquals(Direction.SOUTH, Direction.NORTH.invert());
    Assert.assertEquals(Direction.WEST, Direction.EAST.invert());
  }

  @Test
  public void invertTwiceShouldNotModifyTheDirection() throws Exception {
    for (Direction direction : Direction.values()) {
      Assert.assertEquals(direction, direction.invert().invert());
    }
  }

  @Test
  public void getAllExceptShouldGetAllDirectionsExceptOne() throws Exception {
    for (Direction direction : Direction.values()) {
      Collection<Direction> allExceptDirection = Direction.getAllExcept(direction);
      Assert.assertFalse(allExceptDirection.contains(direction));
      for (Direction anotherDirection : Direction.values()) {
        if (anotherDirection != direction) {
          Assert.assertTrue(allExceptDirection.contains(anotherDirection));
        }
      }
    }
  }

  @Test
  public void getAllExceptShouldGetAllDirectionsWhenTheArgumentIsNull() throws Exception {
    Collection<Direction> allDirections = Direction.getAllExcept(null);
    Assert.assertTrue(allDirections.containsAll(Arrays.asList(Direction.values())));
  }

}
{'fraction_non_alphanumeric': 0.09908496732026144, 'fraction_numerical': 0.00261437908496732, 'mean_word_length': 4.2627235213204955, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3428258', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1025, 'n_words': 324}