Changeset 1733

Show
Ignore:
Timestamp:
07/22/08 23:06:04 (1 month ago)
Author:
mikey
Message:

add more number types for interaction with other programming languages via easc

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • labs/incubator/src/main/php/net/stubbles/lang/types/stubByte.php

    r1732 r1733  
    88 * @version     $Id$ 
    99 */ 
    10 stubClassLoader::load('net::stubbles::lang::types::stubNumber', 
    11                       'net::stubbles::lang::exceptions::stubIllegalArgumentException' 
    12 ); 
     10stubClassLoader::load('net::stubbles::lang::types::stubNumber'); 
    1311/** 
    1412 * Represents a byte, which is in the range of -128 (-2^7) to 127 ((2^7) - 1). 
  • labs/incubator/src/main/php/net/stubbles/lang/types/stubNumber.php

    r1732 r1733  
    4646     * 
    4747     * @return  int 
     48     * @XMLIgnore 
    4849     */ 
    4950    abstract public function minValue(); 
     
    5354     * 
    5455     * @return  int 
     56     * @XMLIgnore 
    5557     */ 
    5658    abstract public function maxValue(); 
     
    6062     * 
    6163     * @return  int 
     64     * @XMLIgnore 
    6265     */ 
    6366    public function asInt() 
     
    7073     * 
    7174     * @return  float 
     75     * @XMLIgnore 
    7276     */ 
    7377    public function asFloat() 
  • labs/incubator/src/test/php/net/stubbles/lang/LangTestSuite.php

    r1723 r1733  
    2828        $suite->addTestFile($dir . '/types/stubByteTestCase.php'); 
    2929        $suite->addTestFile($dir . '/types/stubBytesTestCase.php'); 
     30        $suite->addTestFile($dir . '/types/stubFloatTestCase.php'); 
     31        $suite->addTestFile($dir . '/types/stubLongTestCase.php'); 
     32        $suite->addTestFile($dir . '/types/stubShortTestCase.php'); 
    3033        return $suite; 
    3134    } 
  • labs/incubator/src/test/php/net/stubbles/lang/types/stubByteTestCase.php

    r1732 r1733  
    2626    public function minValueEqualToMIN_VALUE() 
    2727    { 
    28         $byte = new stubByte(1); 
     28        $byte = new stubByte(stubByte::MIN_VALUE); 
    2929        $this->assertEquals($byte->minValue(), stubByte::MIN_VALUE); 
    3030    } 
     
    3737    public function maxValueEqualToMAX_VALUE() 
    3838    { 
    39         $byte = new stubByte(1); 
     39        $byte = new stubByte(stubByte::MAX_VALUE); 
    4040        $this->assertEquals($byte->maxValue(), stubByte::MAX_VALUE); 
    4141    } 
     
    6161    { 
    6262        $byte = new stubByte(128); 
     63    } 
     64 
     65    /** 
     66     * create an instance from string value 
     67     * 
     68     * @test 
     69     */ 
     70    public function stringValue() 
     71    { 
     72        $byte = new stubByte('75'); 
     73        $this->assertEquals(75, $byte->asInt()); 
     74        $this->assertEquals(75.0, $byte->asFloat()); 
     75         
     76        $byte = new stubByte('-75'); 
     77        $this->assertEquals(-75, $byte->asInt()); 
     78        $this->assertEquals(-75.0, $byte->asFloat()); 
    6379    } 
    6480