<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$
 */
 
  uses('unittest.TestCase');

  /**
   * Shows different test scenarios
   *
   * @purpose  Unit Test
   */
  class DemoTest extends TestCase {
      
    /**
     * A test that always succeeds
     *
     */
    #[@test]
    public function alwaysSucceeds() {
      $this->assertTrue(TRUE);
    }

    /**
     * A test that is ignored
     *
     */
    #[@test, @ignore('Ignored')]
    public function ignored() {
      $this->fail('Ignored test executed', 'executed', 'ignored');
    }

    /**
     * Setup method
     *
     */
    public function setUp() {
      if (0 == strcasecmp('alwaysSkipped', $this->name)) {
        throw(new PrerequisitesNotMetError('Skipping', $this->name));
      }
    }

    /**
     * A test that is skipped due to not met prerequisites.
     *
     */
    #[@test]
    public function alwaysSkipped() {
      $this->fail('Skipped test executed', 'executed', 'skipped');
    }

    /**
     * A test that always fails because of a failed assertion
     *
     */
    #[@test]
    public function alwaysFails() {
      $this->assertTrue(FALSE);
    }

    /**
     * A test that always fails because the expected exception was not
     * thrown.
     *
     */
    #[@test, @expect('lang.IllegalArgumentException')]
    public function expectedExceptionNotThrown() {
      TRUE;
    }

    /**
     * A test that timeouts
     *
     */
    #[@test, @limit(time= 0.1)]
    public function timeouts() {
      $start= gettimeofday();
      $end= (1000000 * $start['sec']) + $start['usec'] + 1000 * 200;    // 0.2 seconds
      do {
        $now= gettimeofday();
      } while ((1000000 * $now['sec']) + $now['usec'] < $end);
    }<commit_msg>- Add throwsAnException() method<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$
 */
 
  uses('unittest.TestCase');

  /**
   * Shows different test scenarios
   *
   * @purpose  Unit Test
   */
  class DemoTest extends TestCase {
      
    /**
     * A test that always succeeds
     *
     */
    #[@test]
    public function alwaysSucceeds() {
      $this->assertTrue(TRUE);
    }

    /**
     * A test that is ignored
     *
     */
    #[@test, @ignore('Ignored')]
    public function ignored() {
      $this->fail('Ignored test executed', 'executed', 'ignored');
    }

    /**
     * Setup method
     *
     */
    public function setUp() {
      if (0 == strcasecmp('alwaysSkipped', $this->name)) {
        throw(new PrerequisitesNotMetError('Skipping', $this->name));
      }
    }

    /**
     * A test that is skipped due to not met prerequisites.
     *
     */
    #[@test]
    public function alwaysSkipped() {
      $this->fail('Skipped test executed', 'executed', 'skipped');
    }

    /**
     * A test that always fails because of a failed assertion
     *
     */
    #[@test]
    public function alwaysFails() {
      $this->assertTrue(FALSE);
    }

    /**
     * A test that always fails because the expected exception was not
     * thrown.
     *
     */
    #[@test, @expect('lang.IllegalArgumentException')]
    public function expectedExceptionNotThrown() {
      TRUE;
    }

    /**
     * A test that always fails because an exception is thrown.
     *
     */
    #[@test]
    public function throwsAnException() {
      throw new IllegalArgumentException('');
    }

    /**
     * A test that timeouts
     *
     */
    #[@test, @limit(time= 0.1)]
    public function timeouts() {
      $start= gettimeofday();
      $end= (1000000 * $start['sec']) + $start['usec'] + 1000 * 200;    // 0.2 seconds
      do {
        $now= gettimeofday();
      } while ((1000000 * $now['sec']) + $now['usec'] < $end);
    }
{'fraction_non_alphanumeric': 0.15182403433476394, 'fraction_numerical': 0.013948497854077254, 'mean_word_length': 2.0490596892886344, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '3106284', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1155, 'n_words': 298}