<commit_before>describe('Board', function() {
  var board;

  beforeEach(function() {
    board = new Board();
  });

  describe('#get_board', function() {
    function count_tiles(board) {
      var tiles = 0;
      for(var y = 0; y < board.length; y++) {
        tiles += board[y].length;
      }

      return tiles;
    }

    it('should have 5 rows', function() {
      expect(board.get_board().length).toEqual(5);
    });

    it('should have 25 tiles', function() {
      expect(count_tiles(board.get_board())).toEqual(25);
    });
  });

  describe('#contains', function() {
    describe('when the board contains a specified integer', function() {
      it('returns true', function() {
        board.set_random_empty_tile(2);
        expect(board.contains(2)).toEqual(true);
      });
    });

    describe('when the board does not contain a specified integer', function() {
      it('returns false', function() {
        expect(board.contains(2)).toEqual(false);
      });
    });
  });

  describe('#find_empty_nodes', function() {
    it('should return an array with the index of each empty node', function() {
      expect(board.find_empty_nodes().length).toEqual(25);
    });
  });

  describe('#select_random_empty_tile', function() {
    it('should return a random empty tile', function() {
      expect(board.select_random_empty_tile()).toBeGreaterThan(0);
    });
  });

  describe('#get_tile_coords', function() {
    it('returns the x and y coordinates of the first tile', function() {
      expect(board.get_tile_coords(0)).toEqual({ x: 0, y: 0 });
    });

    it('returns the x and y coordinates of the last tile', function() {
      expect(board.get_tile_coords(24)).toEqual({ x: 4, y: 4 });
    });
  });

  describe('#set_random_empty_tile', function() {
    it('sets a random tile to the specified integer', function() {
      board.set_random_empty_tile(2);
      expect(_.chain(board).flatten().contains(2).value()).toEqual(true);
    });
  });

  describe('#collapse_left', function() {
    it('pushes all tiles to the left', function() {
      board.board = [
        [0, 0, 0, 0, 2],
        [2, 2, 0, 0, 0],
        [2, 0, 2, 0, 0],
        [2, 0, 0, 2, 0],
        [2, 0, 0, 0, 2]
      ];

      var after = [
        [2, 0, 0, 0, 0],
        [2, 2, 0, 0, 0],
        [2, 2, 0, 0, 0],
        [2, 2, 0, 0, 0],
        [2, 2, 0, 0, 0]
      ];

      board.collapse_left();
      expect(board.board).toEqual(after);
    });
  });

  describe('#collapse_right', function() {
    it('pushes all tiles to the right', function() {
      board.board = [
        [0, 0, 0, 0, 2],
        [2, 2, 0, 0, 0],
        [2, 0, 2, 0, 0],
        [2, 0, 0, 2, 0],
        [2, 0, 0, 0, 2]
      ];

      var after = [
        [0, 0, 0, 0, 2],
        [0, 0, 0, 2, 2],
        [0, 0, 0, 2, 2],
        [0, 0, 0, 2, 2],
        [0, 0, 0, 2, 2]
      ];

      board.collapse_right();
      expect(board.board).toEqual(after);
    });
  });

  describe('#fold_left', function() {
    it('merges all tiles one space to the left', function() {
      board.board = [
        [2, 2, 2, 0, 0],
        [2, 4, 0, 4, 0],
        [0, 8, 8, 0, 0],
        [0, 0, 4, 4, 0],
        [0, 0, 0, 0, 8]
      ];

      var after = [
        [4,  0, 2, 0, 0],
        [2,  4, 0, 4, 0],
        [0, 16, 0, 0, 0],
        [0,  0, 8, 0, 0],
        [0,  0, 0, 0, 8]
      ];

      board.fold();
      expect(board.board).toEqual(after);
    });
  });

  describe('#fold_right', function() {
    it('merges all tiles one space to the right', function() {
      board.board = [
        [2, 2, 2, 0, 0],
        [2, 4, 0, 4, 0],
        [0, 8, 8, 0, 0],
        [0, 0, 4, 4, 0],
        [0, 0, 0, 0, 8]
      ];<commit_msg>Fix another merge issue.<commit_after>describe('Board', function() {
  var board;

  beforeEach(function() {
    board = new Board();
  });

  describe('#get_board', function() {
    function count_tiles(board) {
      var tiles = 0;
      for(var y = 0; y < board.length; y++) {
        tiles += board[y].length;
      }

      return tiles;
    }

    it('should have 5 rows', function() {
      expect(board.get_board().length).toEqual(5);
    });

    it('should have 25 tiles', function() {
      expect(count_tiles(board.get_board())).toEqual(25);
    });
  });

  describe('#contains', function() {
    describe('when the board contains a specified integer', function() {
      it('returns true', function() {
        board.set_random_empty_tile(2);
        expect(board.contains(2)).toEqual(true);
      });
    });

    describe('when the board does not contain a specified integer', function() {
      it('returns false', function() {
        expect(board.contains(2)).toEqual(false);
      });
    });
  });

  describe('#find_empty_nodes', function() {
    it('should return an array with the index of each empty node', function() {
      expect(board.find_empty_nodes().length).toEqual(25);
    });
  });

  describe('#select_random_empty_tile', function() {
    it('should return a random empty tile', function() {
      expect(board.select_random_empty_tile()).toBeGreaterThan(0);
    });
  });

  describe('#get_tile_coords', function() {
    it('returns the x and y coordinates of the first tile', function() {
      expect(board.get_tile_coords(0)).toEqual({ x: 0, y: 0 });
    });

    it('returns the x and y coordinates of the last tile', function() {
      expect(board.get_tile_coords(24)).toEqual({ x: 4, y: 4 });
    });
  });

  describe('#set_random_empty_tile', function() {
    it('sets a random tile to the specified integer', function() {
      board.set_random_empty_tile(2);
      expect(_.chain(board).flatten().contains(2).value()).toEqual(true);
    });
  });

  describe('#collapse_left', function() {
    it('pushes all tiles to the left', function() {
      board.board = [
        [0, 0, 0, 0, 2],
        [2, 2, 0, 0, 0],
        [2, 0, 2, 0, 0],
        [2, 0, 0, 2, 0],
        [2, 0, 0, 0, 2]
      ];

      var after = [
        [2, 0, 0, 0, 0],
        [2, 2, 0, 0, 0],
        [2, 2, 0, 0, 0],
        [2, 2, 0, 0, 0],
        [2, 2, 0, 0, 0]
      ];

      board.collapse_left();
      expect(board.board).toEqual(after);
    });
  });

  describe('#collapse_right', function() {
    it('pushes all tiles to the right', function() {
      board.board = [
        [0, 0, 0, 0, 2],
        [2, 2, 0, 0, 0],
        [2, 0, 2, 0, 0],
        [2, 0, 0, 2, 0],
        [2, 0, 0, 0, 2]
      ];

      var after = [
        [0, 0, 0, 0, 2],
        [0, 0, 0, 2, 2],
        [0, 0, 0, 2, 2],
        [0, 0, 0, 2, 2],
        [0, 0, 0, 2, 2]
      ];

      board.collapse_right();
      expect(board.board).toEqual(after);
    });
  });

  describe('#fold_left', function() {
    it('merges all tiles one space to the left', function() {
      board.board = [
        [2, 2, 2, 0, 0],
        [2, 4, 0, 4, 0],
        [0, 8, 8, 0, 0],
        [0, 0, 4, 4, 0],
        [0, 0, 0, 0, 8]
      ];

      var after = [
        [4,  0, 2, 0, 0],
        [2,  4, 0, 4, 0],
        [0, 16, 0, 0, 0],
        [0,  0, 8, 0, 0],
        [0,  0, 0, 0, 8]
      ];

      board.fold_left();
      expect(board.board).toEqual(after);
    });
  });

  describe('#fold_right', function() {
    it('merges all tiles one space to the right', function() {
      board.board = [
        [2, 2, 2, 0, 0],
        [2, 4, 0, 4, 0],
        [0, 8, 8, 0, 0],
        [0, 0, 4, 4, 0],
        [0, 0, 0, 0, 8]
      ];
{'fraction_non_alphanumeric': 0.19208053691275168, 'fraction_numerical': 0.05342281879194631, 'mean_word_length': 2.095554632322393, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1042412', 'n_tokens_mistral': 2944, 'n_tokens_neox': 2623, 'n_words': 741}