<commit_before><?php
// $Id: cookies_test.php 1506 2007-05-07 00:58:03Z lastcraft $
require_once(dirname(__FILE__) . '/../autorun.php');
require_once(dirname(__FILE__) . '/../arguments.php');

class TestOfCommandLineArgumentParsing extends UnitTestCase {
    function testArgumentListWithJustProgramNameGivesFalseToEveryName() {
        $arguments = new SimpleArguments(array('me'));
        $this->assertIdentical($arguments->a, false);
        $this->assertIdentical($arguments->all(), array());
    }
    
    function testSingleArgumentNameRecordedAsTrue() {
        $arguments = new SimpleArguments(array('me', '-a'));
        $this->assertIdentical($arguments->a, true);
    }
    
    function testSingleArgumentCanBeGivenAValue() {
        $arguments = new SimpleArguments(array('me', '-a=AAA'));
        $this->assertIdentical($arguments->a, 'AAA');
    }
    
    function testSingleArgumentCanBeGivenSpaceSeparatedValue() {
        $arguments = new SimpleArguments(array('me', '-a', 'AAA'));
        $this->assertIdentical($arguments->a, 'AAA');
    }
    
    function testWillBuildArrayFromRepeatedValue() {
        $arguments = new SimpleArguments(array('me', '-a', 'A', '-a', 'AA'));
        $this->assertIdentical($arguments->a, array('A', 'AA'));
    }
    
    function testWillBuildArrayFromMultiplyRepeatedValues() {
        $arguments = new SimpleArguments(array('me', '-a', 'A', '-a', 'AA', '-a', 'AAA'));
        $this->assertIdentical($arguments->a, array('A', 'AA', 'AAA'));
    }
    
    function testCanParseLongFormArguments() {
        $arguments = new SimpleArguments(array('me', '--aa=AA', '--bb', 'BB'));
        $this->assertIdentical($arguments->aa, 'AA');
        $this->assertIdentical($arguments->bb, 'BB');
    }
    
    function testGetsFullSetOfResultsAsHash() {
        $arguments = new SimpleArguments(array('me', '-a', '-b=1', '-b', '2', '--aa=AA', '--bb', 'BB', '-c'));
        $this->assertEqual($arguments->all(),
                           array('a' => true, 'b' => array('1', '2'), 'aa' => 'AA', 'bb' => 'BB', 'c' => true));
    }
}

class TestOfHelpOutput extends UnitTestCase {
    function testDisplaysGeneralHelpBanner() {
        $help = new SimpleHelp('This program is cool');
        $this->assertPattern('/This program is cool/', $help->render());
    }
    
    function testDisplaysHelpOnShortFlag() {
        $help = new SimpleHelp('This program is cool');
        $help->explainFlag('a', 'This enables the AAA widget');
        $this->assertPattern('/-a\tThis enables the AA widget/', $help->render());
    }
}
?><commit_msg>Extra test for lots of arguments<commit_after><?php
// $Id: cookies_test.php 1506 2007-05-07 00:58:03Z lastcraft $
require_once(dirname(__FILE__) . '/../autorun.php');
require_once(dirname(__FILE__) . '/../arguments.php');

class TestOfCommandLineArgumentParsing extends UnitTestCase {
    function testArgumentListWithJustProgramNameGivesFalseToEveryName() {
        $arguments = new SimpleArguments(array('me'));
        $this->assertIdentical($arguments->a, false);
        $this->assertIdentical($arguments->all(), array());
    }
    
    function testSingleArgumentNameRecordedAsTrue() {
        $arguments = new SimpleArguments(array('me', '-a'));
        $this->assertIdentical($arguments->a, true);
    }
    
    function testSingleArgumentCanBeGivenAValue() {
        $arguments = new SimpleArguments(array('me', '-a=AAA'));
        $this->assertIdentical($arguments->a, 'AAA');
    }
    
    function testSingleArgumentCanBeGivenSpaceSeparatedValue() {
        $arguments = new SimpleArguments(array('me', '-a', 'AAA'));
        $this->assertIdentical($arguments->a, 'AAA');
    }
    
    function testWillBuildArrayFromRepeatedValue() {
        $arguments = new SimpleArguments(array('me', '-a', 'A', '-a', 'AA'));
        $this->assertIdentical($arguments->a, array('A', 'AA'));
    }
    
    function testWillBuildArrayFromMultiplyRepeatedValues() {
        $arguments = new SimpleArguments(array('me', '-a', 'A', '-a', 'AA', '-a', 'AAA'));
        $this->assertIdentical($arguments->a, array('A', 'AA', 'AAA'));
    }
    
    function testCanParseLongFormArguments() {
        $arguments = new SimpleArguments(array('me', '--aa=AA', '--bb', 'BB'));
        $this->assertIdentical($arguments->aa, 'AA');
        $this->assertIdentical($arguments->bb, 'BB');
    }
    
    function testGetsFullSetOfResultsAsHash() {
        $arguments = new SimpleArguments(array('me', '-a', '-b=1', '-b', '2', '--aa=AA', '--bb', 'BB', '-c'));
        $this->assertEqual($arguments->all(),
                           array('a' => true, 'b' => array('1', '2'), 'aa' => 'AA', 'bb' => 'BB', 'c' => true));
    }
}

class TestOfHelpOutput extends UnitTestCase {
    function testDisplaysGeneralHelpBanner() {
        $help = new SimpleHelp('This program is cool');
        $this->assertPattern('/This program is cool/', $help->render());
    }
    
    function TODO_testDisplaysHelpOnShortFlag() {
        $help = new SimpleHelp('This program is cool');
        $help->explainFlag('a', 'This enables the AAA widget');
        $this->assertPattern('/-a\tThis enables the AA widget/', $help->render());
    }
}
?>
{'fraction_non_alphanumeric': 0.18661023470565602, 'fraction_numerical': 0.008464794151596768, 'mean_word_length': 3.3542713567839195, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 65, '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': '3359965', 'n_tokens_mistral': 1590, 'n_tokens_neox': 1539, 'n_words': 305}