<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$
 */
 
  uses('net.xp_framework.tools.vm.unittest.emit.php5.AbstractEmitterTest');

  /**
   * Tests PHP5 emitter
   *
   * @purpose  Unit Test
   */
  class OperatorEmitterTest extends AbstractEmitterTest {

    /**
     * Tests post-inc operator (expr++)
     *
     * @access  public
     */
    #[@test]
    function postInc() {
      $this->assertSourcecodeEquals(
        '$i++;',
        $this->emit('$i++;')
      );
    }

    /**
     * Tests post-dec operator (expr--)
     *
     * @access  public
     */
    #[@test]
    function postDec() {
      $this->assertSourcecodeEquals(
        '$i--;',
        $this->emit('$i--;')
      );
    }

    /**
     * Tests pre-inc operator (++expr)
     *
     * @access  public
     */
    #[@test]
    function preInc() {
      $this->assertSourcecodeEquals(
        '++$i;',
        $this->emit('++$i;')
      );
    }

    /**
     * Tests pre-dec operator (--expr)
     *
     * @access  public
     */
    #[@test]
    function preDec() {
      $this->assertSourcecodeEquals(
        '--$i;',
        $this->emit('--$i;')
      );
    }

    /**
     * Tests equality operator
     *
     * @access  public
     */
    #[@test]
    function equality() {
      $this->assertSourcecodeEquals(
        '$a==$b;',
        $this->emit('$a == $b;')
      );<commit_msg>- Add tests for the operators . + - * / % and their assignments (.=, +=, ...)<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$
 */
 
  uses('net.xp_framework.tools.vm.unittest.emit.php5.AbstractEmitterTest');

  /**
   * Tests PHP5 emitter
   *
   * @purpose  Unit Test
   */
  class OperatorEmitterTest extends AbstractEmitterTest {

    /**
     * Tests post-inc operator (expr++)
     *
     * @access  public
     */
    #[@test]
    function postInc() {
      $this->assertSourcecodeEquals(
        '$i++;',
        $this->emit('$i++;')
      );
    }

    /**
     * Tests post-dec operator (expr--)
     *
     * @access  public
     */
    #[@test]
    function postDec() {
      $this->assertSourcecodeEquals(
        '$i--;',
        $this->emit('$i--;')
      );
    }

    /**
     * Tests pre-inc operator (++expr)
     *
     * @access  public
     */
    #[@test]
    function preInc() {
      $this->assertSourcecodeEquals(
        '++$i;',
        $this->emit('++$i;')
      );
    }

    /**
     * Tests pre-dec operator (--expr)
     *
     * @access  public
     */
    #[@test]
    function preDec() {
      $this->assertSourcecodeEquals(
        '--$i;',
        $this->emit('--$i;')
      );
    }

    /**
     * Tests concat operator (.)
     *
     * @access  public
     */
    #[@test]
    function concat() {
      $this->assertSourcecodeEquals(
        '$a.$b;',
        $this->emit('$a.$b;')
      );
    }

    /**
     * Tests addition operator (+)
     *
     * @access  public
     */
    #[@test]
    function addition() {
      $this->assertSourcecodeEquals(
        '$a+$b;',
        $this->emit('$a + $b;')
      );
    }

    /**
     * Tests addition operator (-)
     *
     * @access  public
     */
    #[@test]
    function subtraction() {
      $this->assertSourcecodeEquals(
        '$a-$b;',
        $this->emit('$a - $b;')
      );
    }

    /**
     * Tests multiplication operator (*)
     *
     * @access  public
     */
    #[@test]
    function multiplication() {
      $this->assertSourcecodeEquals(
        '$a*$b;',
        $this->emit('$a * $b;')
      );
    }

    /**
     * Tests division operator (/)
     *
     * @access  public
     */
    #[@test]
    function division() {
      $this->assertSourcecodeEquals(
        '$a/$b;',
        $this->emit('$a / $b;')
      );
    }

    /**
     * Tests modulo operator (%)
     *
     * @access  public
     */
    #[@test]
    function modulo() {
      $this->assertSourcecodeEquals(
        '$a%$b;',
        $this->emit('$a % $b;')
      );
    }

    /**
     * Tests concat operator (.)
     *
     * @access  public
     */
    #[@test]
    function concatAssign() {
      $this->assertSourcecodeEquals(
        '$a.= $b;',
        $this->emit('$a.= $b;')
      );
    }

    /**
     * Tests addition operator (+)
     *
     * @access  public
     */
    #[@test]
    function additionAssign() {
      $this->assertSourcecodeEquals(
        '$a+= $b;',
        $this->emit('$a+= $b;')
      );
    }

    /**
     * Tests addition operator (-)
     *
     * @access  public
     */
    #[@test]
    function subtractionAssign() {
      $this->assertSourcecodeEquals(
        '$a-= $b;',
        $this->emit('$a-= $b;')
      );
    }

    /**
     * Tests multiplication operator (*)
     *
     * @access  public
     */
    #[@test]
    function multiplicationAssign() {
      $this->assertSourcecodeEquals(
        '$a*= $b;',
        $this->emit('$a*= $b;')
      );
    }

    /**
     * Tests division operator (/)
     *
     * @access  public
     */
    #[@test]
    function divisionAssign() {
      $this->assertSourcecodeEquals(
        '$a/= $b;',
        $this->emit('$a/= $b;')
      );
    }

    /**
     * Tests modulo operator (%)
     *
     * @access  public
     */
    #[@test]
    function moduloAssign() {
      $this->assertSourcecodeEquals(
        '$a%= $b;',
        $this->emit('$a%= $b;')
      );
    }

    /**
     * Tests equality operator
     *
     * @access  public
     */
    #[@test]
    function equality() {
      $this->assertSourcecodeEquals(
        '$a==$b;',
        $this->emit('$a == $b;')
      );
{'fraction_non_alphanumeric': 0.19320214669051877, 'fraction_numerical': 0.0007155635062611807, 'mean_word_length': 1.53905540417802, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '2775811', 'n_tokens_mistral': 1909, 'n_tokens_neox': 1852, 'n_words': 320}