<commit_before><?php
/**
 * Unit testing for the FixedWidthReader class.
 *
 */
class Test_FixedWidthReaderTest extends Test_TabularReaderTest
{   
    /**
     * Set up the test fixture.
     *
     * This is called before each test is run so that they are isolated from 
     * any side effects.
     */
    protected function setUp()
    {
        $this->fields = array(
            new Serial_Core_IntField('int', array(0, 3), '%3d'),
            new Serial_Core_ArrayField('arr', array(3, null), array(
                new Serial_Core_StringField('x', array(0, 3), '%3s'),
                new Serial_Core_StringField('y', array(3, 3), '%3s'),                
            )), 
        );
        $this->data = "123abcdef\n456ghijkl\n";
        parent::setUp();
        $this->reader = new Serial_Core_FixedWidthReader($this->stream, 
                        $this->fields);        
        return;
    }

    /**
     * Test the open() method.
     * 
     */
    public function testOpen()
    {
        // TODO: This only tests an open stream; also need to test with a file
        // path.
        $this->reader = Serial_Core_FixedWidthReader::open($this->stream, 
                        $this->fields);
        $this->test_iter();
        unset($this->reader);  // close $this->stream
        $this->assertFalse(is_resource($this->stream));
        return;
    }
}<commit_msg>improved tests for FixedWidthReader<commit_after><?php
/**
 * Unit testing for the FixedWidthReader class.
 *
 */
class Test_FixedWidthReaderTest extends Test_TabularReaderTest
{   
    /**
     * Set up the test fixture.
     *
     * This is called before each test is run so that they are isolated from 
     * any side effects.
     */
    protected function setUp()
    {
        $this->fields = array(
            new Serial_Core_IntField('int', array(0, 4), '%3d'),
            new Serial_Core_ArrayField('arr', array(4, null), array(
                new Serial_Core_StringField('x', array(0, 4), '%3s'),
                new Serial_Core_StringField('y', array(4, 4), '%3s'),                
            )), 
        );
        $this->data = " 123 abc def\n 456 ghi jkl\n";
        parent::setUp();
        $this->reader = new Serial_Core_FixedWidthReader($this->stream, 
                        $this->fields);        
        return;
    }

    /**
     * Test the open() method.
     * 
     */
    public function testOpen()
    {
        // TODO: This only tests an open stream; also need to test with a file
        // path.
        $this->reader = Serial_Core_FixedWidthReader::open($this->stream, 
                        $this->fields);
        $this->test_iter();
        unset($this->reader);  // close $this->stream
        $this->assertFalse(is_resource($this->stream));
        return;
    }
}
{'fraction_non_alphanumeric': 0.13080771979985703, 'fraction_numerical': 0.01143674052894925, 'mean_word_length': 1.85030549898167, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '6317778', 'n_tokens_mistral': 828, 'n_tokens_neox': 789, 'n_words': 202}