<commit_before><?php

namespace Gravity;

/**
 * Test for IceBlockSimulator class.
 *
 * @author <NAME> <<EMAIL>>
 */
class IceBlockSimulatorTest extends \PHPUnit_Framework_TestCase
{
    /**
     * The instance of the class to test.
     *
     * @var IceBlockSimulator
     */
    private $obj;

    /**
     * Executed before every test case.
     */
    public function setUp()
    {
        $this->obj = new IceBlockSimulator();
    }

    /**
     * Tests that simulateData method throws an EmptySimulationDataException when the simulation data is empty.
     */
    public function testThatSimulateThrowsExceptionWhenSimulationDataIsEmpty()
    {
        $this->setExpectedException( 'Gravity\EmptySimulationDataException' );
        $this->obj->simulateData( array(), array() );
    }

    /**
     * Data provider for testSimulateData method.
     *
     * @return array
     */
    public function simulateDataProvider()
    {
        return array(
            'One block falls' => array(
                'data_to_simulate' => array(
                    array( '|X|', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                ),
                'block_to_move' => array(),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'message' => 'The block must be at the bottom'
            ),
            'One block pushed from left' => array(
                'data_to_simulate' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'block_to_move' => array(
                    'x' => 0,
                    'y' => 2
                ),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '', '|X|', '', '', '' ),
                ),
                'message' => 'The block must move to the right'
            ),
            'Multiple blocks fall' => array(
                'data_to_simulate' => array(
                    array( '|X|', '|X|', '', '|X|', '|X|' ),
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                ),
                'block_to_move' => array(),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '|X|', '', '|X|', '|X|' ),
                ),
                'message' => 'The blocks must fall to the bottom'
            ),
            'One block falls having one at bottom' => array(
                'data_to_simulate' => array(
                    array( '|X|', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'block_to_move' => array(),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'message' => 'The block must fall on the bottom placed block'
            ),
            'Push block and the block over it falls' => array(
                'data_to_simulate' => array(
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'block_to_move' => array(
                    'x' => 0,
                    'y' => 2
                ),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '|X|', '', '', '' ),
                ),
                'message' => 'The block must fall where the below block was positioned'
            ),
            'Two blocks falling in top of each other' => array(
                'data_to_simulate' => array(
                    array( '|X|', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                ),
                'block_to_move' => array(),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'message' => 'Both blocks must fall'
            ),
            'Multiple blocks falling in top of each other' => array(
                'data_to_simulate' => array(
                    array( '|X|' ),
                    array( '' ),
                    array( '' ),
                    array( '|X|' ),
                    array( '|X|' ),
                    array( '|X|' ),
                    array( '' ),
                ),
                'block_to_move' => array(),
                'expected' => array(
                    array( '' ),
                    array( '' ),
                    array( '' ),
                    array( '|X|' ),
                    array( '|X|' ),
                    array( '|X|' ),
                    array( '|X|' ),
                ),
                'message' => 'Both blocks must fall'
            ),
            'Push block with another block next to it' => array(
                'data_to_simulate' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '|X|', '', '', '' ),
                ),
                'block_to_move' => array(
                    'x' => 0,
                    'y' => 2
                ),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '', '|X|', '|X|', '', '' ),
                ),
                'message' => 'Both blocks must move one place to their right'
            ),
        );
    }

    /**<commit_msg>- Added one data provider key - Tests still passing<commit_after><?php

namespace Gravity;

/**
 * Test for IceBlockSimulator class.
 *
 * @author <NAME> <<EMAIL>>
 */
class IceBlockSimulatorTest extends \PHPUnit_Framework_TestCase
{
    /**
     * The instance of the class to test.
     *
     * @var IceBlockSimulator
     */
    private $obj;

    /**
     * Executed before every test case.
     */
    public function setUp()
    {
        $this->obj = new IceBlockSimulator();
    }

    /**
     * Tests that simulateData method throws an EmptySimulationDataException when the simulation data is empty.
     */
    public function testThatSimulateThrowsExceptionWhenSimulationDataIsEmpty()
    {
        $this->setExpectedException( 'Gravity\EmptySimulationDataException' );
        $this->obj->simulateData( array(), array() );
    }

    /**
     * Data provider for testSimulateData method.
     *
     * @return array
     */
    public function simulateDataProvider()
    {
        return array(
            'One block falls' => array(
                'data_to_simulate' => array(
                    array( '|X|', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                ),
                'block_to_move' => array(),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'message' => 'The block must be at the bottom'
            ),
            'One block pushed from left' => array(
                'data_to_simulate' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'block_to_move' => array(
                    'x' => 0,
                    'y' => 2
                ),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '', '|X|', '', '', '' ),
                ),
                'message' => 'The block must move to the right'
            ),
            'Multiple blocks fall' => array(
                'data_to_simulate' => array(
                    array( '|X|', '|X|', '', '|X|', '|X|' ),
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                ),
                'block_to_move' => array(),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '|X|', '', '|X|', '|X|' ),
                ),
                'message' => 'The blocks must fall to the bottom'
            ),
            'One block falls having one at bottom' => array(
                'data_to_simulate' => array(
                    array( '|X|', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'block_to_move' => array(),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'message' => 'The block must fall on the bottom placed block'
            ),
            'Push block and the block over it falls' => array(
                'data_to_simulate' => array(
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'block_to_move' => array(
                    'x' => 0,
                    'y' => 2
                ),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '|X|', '', '', '' ),
                ),
                'message' => 'The block must fall where the below block was positioned'
            ),
            'Two blocks falling in top of each other' => array(
                'data_to_simulate' => array(
                    array( '|X|', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                ),
                'block_to_move' => array(),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                    array( '|X|', '', '', '', '' ),
                ),
                'message' => 'Both blocks must fall'
            ),
            'Multiple blocks falling in top of each other' => array(
                'data_to_simulate' => array(
                    array( '|X|' ),
                    array( '' ),
                    array( '' ),
                    array( '|X|' ),
                    array( '|X|' ),
                    array( '|X|' ),
                    array( '' ),
                ),
                'block_to_move' => array(),
                'expected' => array(
                    array( '' ),
                    array( '' ),
                    array( '' ),
                    array( '|X|' ),
                    array( '|X|' ),
                    array( '|X|' ),
                    array( '|X|' ),
                ),
                'message' => 'Both blocks must fall'
            ),
            'Push block with another block next to it' => array(
                'data_to_simulate' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '|X|', '|X|', '', '', '' ),
                ),
                'block_to_move' => array(
                    'x' => 0,
                    'y' => 2
                ),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '', '', '', '', '' ),
                    array( '', '|X|', '|X|', '', '' ),
                ),
                'message' => 'Both blocks must move one place to their right'
            ),
            'Push multiple blocks and one falls' => array(
                'data_to_simulate' => array(
                    array( '', '', '', '', '' ),
                    array( '|X|', '|X|', '', '|X|', '' ),
                    array( '|X|', '|X|', '', '|X|', '|X|' ),
                ),
                'block_to_move' => array(
                    'x' => 0,
                    'y' => 1
                ),
                'expected' => array(
                    array( '', '', '', '', '' ),
                    array( '', '|X|', '', '|X|', '' ),
                    array( '|X|', '|X|', '|X|', '|X|', '|X|' ),
                ),
                'message' => 'There has to be 2 blocks on top and the bottom full'
            ),
        );
    }

    /**
{'fraction_non_alphanumeric': 0.20230867251330484, 'fraction_numerical': 0.001124353496739375, 'mean_word_length': 1.0042060988433228, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 116, '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': '2479419', 'n_tokens_mistral': 3580, 'n_tokens_neox': 3303, 'n_words': 746}