<commit_before>package controllers;

import java.awt.Color;
import java.awt.event.MouseEvent;
import java.io.File;

import view.BoardView;
import view.BullpenView;
import view.LevelView;
import model.Board;
import model.BoardTile;
import model.Bullpen;
import model.ReleaseLevel;
import model.ReleaseTile;
import app.Game;
import app.LevelFactory;
import junit.framework.TestCase;

public class TestPlayerRelease extends TestCase {
	
	Game game;
	ReleaseLevel level;
	LevelView levelView;
	Board board;
	BoardView boardView;
	Bullpen bullpen;
	BullpenView bullpenView;
	LevelFactory factory;
	
	
	@Override
	public void setUp() {
		/*
		 * create a single puzzle level 
		 */
		new File("./imbriusLevelTESTING/").mkdirs();
		factory = new LevelFactory();
		factory.setDirectory("./imbriusLevelTESTING/");
		ReleaseLevel tempLevel = factory.GenerateBlankRelease(1);
		factory.saveLevel(tempLevel);
		factory.addToData(tempLevel, 1);
		
		/*
		 * load and display the level in a game
		 */
		game = new Game("./imbriusLevelTESTING/");
		game.displayLevel(1);
		
		/*
		 * set attributes for this test class
		 */
		level = (ReleaseLevel) game.getCurrentLevel();
		levelView = game.getLevelView();
		board = level.getBoard();
		bullpen = level.getBullpen();
		boardView = levelView.getBoardView();
		bullpenView = levelView.getBullpenView();
		
	}
	
	@Override
	public void tearDown() {
		File dir = new File("./imbriusLevelTESTING/");
		for(File file: dir.listFiles()) {file.delete();}
		dir.delete();
	}
	
	//====================== Tile Placements ======================//
	public void testPlacePiece () {
		MouseEvent me;
		/*
		 * initialize board with 18 release tiles and 18 board tiles and verify
		 */
		for(int i = 0; i < 6; i++) {
			for(int j = 0; j < 3; j++) {
				board.swapTile(new BoardTile(i, j));
			}
		}
		
		// Blue tiles
		for(int i = 1; i <= 6; i++) {
			board.swapTile(new ReleaseTile(i-1, 3, i, Color.BLUE));
		}
		
		// Red tiles
		for(int i = 1; i <= 6; i++) {
			board.swapTile(new ReleaseTile(i-1, 4, i, Color.RED));
		}
		
		// Green tiles
		for(int i = 1; i <= 6; i++) {
			board.swapTile(new ReleaseTile(i-1, 5, i, Color.GREEN));
		}
		
		assertEquals(18, board.getNumBoardTiles());
		
		/*
		 * initialize bullpen
		 */
		bullpen.incrementPiece(1);
		bullpen.setSelectedPiece(1);
		
		/*
		 * create mouse moved to show preview
		 */
		me = new MouseEvent(boardView, 
				MouseEvent.MOUSE_MOVED, 
				System.currentTimeMillis(), 0, 
				2*board.getTileSize(), 
				6*board.getTileSize(), 0, false);

	}
	
	
	//====================== Test Stars Earned ======================//
	public void testStarsEarned() {
		/*
		 * initialize board with 18 board tiles and verify
		 */
		for(int i = 0; i < 6; i++) {
			for(int j = 0; j < 3; j++) {
				board.swapTile(new BoardTile(i, j));
			}
		}
		assertEquals(18, board.getNumBoardTiles());

	}

}
<commit_msg>completed player release tests<commit_after>package controllers;

import java.awt.Color;
import java.awt.event.MouseEvent;
import java.io.File;

import view.BoardView;
import view.BullpenView;
import view.LevelView;
import model.Board;
import model.BoardTile;
import model.Bullpen;
import model.ReleaseLevel;
import model.ReleaseTile;
import app.Game;
import app.LevelFactory;
import junit.framework.TestCase;

public class TestPlayerRelease extends TestCase {
	
	Game game;
	ReleaseLevel level;
	LevelView levelView;
	Board board;
	BoardView boardView;
	Bullpen bullpen;
	BullpenView bullpenView;
	LevelFactory factory;
	
	
	@Override
	public void setUp() {
		/*
		 * create a single puzzle level 
		 */
		new File("./imbriusLevelTESTING/").mkdirs();
		factory = new LevelFactory();
		factory.setDirectory("./imbriusLevelTESTING/");
		ReleaseLevel tempLevel = factory.GenerateBlankRelease(1);
		factory.saveLevel(tempLevel);
		factory.addToData(tempLevel, 1);
		
		/*
		 * load and display the level in a game
		 */
		game = new Game("./imbriusLevelTESTING/");
		game.displayLevel(1);
		
		/*
		 * set attributes for this test class
		 */
		level = (ReleaseLevel) game.getCurrentLevel();
		levelView = game.getLevelView();
		board = level.getBoard();
		bullpen = level.getBullpen();
		boardView = levelView.getBoardView();
		bullpenView = levelView.getBullpenView();
		
	}
	
	@Override
	public void tearDown() {
		File dir = new File("./imbriusLevelTESTING/");
		for(File file: dir.listFiles()) {file.delete();}
		dir.delete();
	}
	
	//====================== Tile Placements ======================//
	public void testPlacePieceAndStars() {
		MouseEvent me;
		/*
		 * initialize board with 18 release tiles and 18 board tiles and verify
		 */
		for(int i = 0; i < 6; i++) {
			for(int j = 0; j < 3; j++) {
				board.swapTile(new BoardTile(i, j));
			}
		}
		
		// Blue tiles
		for(int i = 1; i <= 6; i++) {
			board.swapTile(new ReleaseTile(i-1, 3, i, Color.BLUE));
		}
		
		// Red tiles
		for(int i = 1; i <= 6; i++) {
			board.swapTile(new ReleaseTile(i-1, 4, i, Color.RED));
		}
		
		// Green tiles
		for(int i = 1; i <= 6; i++) {
			board.swapTile(new ReleaseTile(i-1, 5, i, Color.GREEN));
		}
		
		assertEquals(18, board.getNumBoardTiles());
		
		/*
		 * initialize bullpen
		 */
		bullpen.incrementPiece(1);
		bullpen.incrementPiece(1);
		bullpen.incrementPiece(1);
		bullpen.incrementPiece(1);
		bullpen.setSelectedPiece(1);
		
		
		/*
		 * create mouse moved to show preview
		 */
		me = new MouseEvent(boardView, 
				MouseEvent.MOUSE_MOVED, 
				System.currentTimeMillis(), 0, 
				3*board.getTileSize(), 
				2*board.getTileSize(), 0, false);
		level.getBoardController().mouseMoved(me);
		assertEquals(Color.GREEN, board.getTileAt(3*board.getTileSize(), 2*board.getTileSize()).getColor());
		assertEquals("release", board.getTileAt(3*board.getTileSize(), 2*board.getTileSize()).getTileType());
		
		/*
		 * release Blues
		 */
		me = new MouseEvent(boardView, 
				MouseEvent.MOUSE_PRESSED, 
				System.currentTimeMillis(), 0, 
				3*board.getTileSize(), 
				2*board.getTileSize(), 0, false);
		level.getBoardController().mousePressed(me);
		assertFalse(level.checkStatus());
		assertEquals(1, level.getStarsEarned());
		
		/*
		 * release Reds
		 */
		me = new MouseEvent(boardView, 
				MouseEvent.MOUSE_PRESSED, 
				System.currentTimeMillis(), 0, 
				4*board.getTileSize(), 
				2*board.getTileSize(), 0, false);
		bullpen.setSelectedPiece(1);
		level.getBoardController().mousePressed(me);
		assertFalse(level.checkStatus());
		assertEquals(2, level.getStarsEarned());
		
		/*
		 * release Greens
		 */
		me = new MouseEvent(boardView, 
				MouseEvent.MOUSE_PRESSED, 
				System.currentTimeMillis(), 0, 
				5*board.getTileSize(), 
				2*board.getTileSize(), 0, false);
		bullpen.setSelectedPiece(1);
		level.getBoardController().mousePressed(me);
		assertTrue(level.checkStatus());
		assertEquals(3, level.getStarsEarned());
	}
}

{'fraction_non_alphanumeric': 0.15710102489019034, 'fraction_numerical': 0.01376281112737921, 'mean_word_length': 3.6, 'pattern_counts': {'":': 0, '<': 15, '<?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': '2126580', 'n_tokens_mistral': 2714, 'n_tokens_neox': 2284, 'n_words': 516}