Package org.eclipse.sapphire

Examples of org.eclipse.sapphire.Version


   
    @Test
   
    public void testVersionCanonicalization()
    {
        Version version;
       
        version = new Version( "1.2.3.0" );

        assertEquals( 3, version.length() );
        assertEquals( 1l, version.segment( 0 ) );
        assertEquals( 2l, version.segment( 1 ) );
        assertEquals( 3l, version.segment( 2 ) );
        assertEquals( 0l, version.segment( 3 ) );
        assertEquals( 0l, version.segment( 1000 ) );
        assertEquals( list( 1l, 2l, 3l ), version.segments() );

        version = new Version( "1.2.3.0.0.0.0" );

        assertEquals( 3, version.length() );
        assertEquals( 1l, version.segment( 0 ) );
        assertEquals( 2l, version.segment( 1 ) );
        assertEquals( 3l, version.segment( 2 ) );
        assertEquals( 0l, version.segment( 3 ) );
        assertEquals( 0l, version.segment( 4 ) );
        assertEquals( 0l, version.segment( 5 ) );
        assertEquals( 0l, version.segment( 6 ) );
        assertEquals( 0l, version.segment( 1000 ) );
        assertEquals( list( 1l, 2l, 3l ), version.segments() );
    }
View Full Code Here


    {
        final TestElement element = TestElement.TYPE.instantiate();
       
        element.setVersion( "1.2.3" );
       
        final Version version = element.getVersion().content();
       
        assertNotNull( version );
        assertEquals( 3, version.length() );
        assertEquals( 1, version.segment( 0 ) );
        assertEquals( 2, version.segment( 1 ) );
        assertEquals( 3, version.segment( 2 ) );
    }
View Full Code Here

   
    @Test
   
    public void testVersionComparison()
    {
        testVersionComparisonSame( new Version( 1 ), new Version( "1" ) );
        testVersionComparisonSame( new Version( "1.2.3" ), new Version( "1.2.3" ) );
        testVersionComparisonSame( new Version( "1.2.3" ), new Version( "1.2.3.0.0" ) );
       
        testVersionComparisonDifferent( new Version( "1.2.4" ), new Version( "1.2.3" ) );
        testVersionComparisonDifferent( new Version( "1.3.3" ), new Version( "1.2.3" ) );
        testVersionComparisonDifferent( new Version( "2.2.3" ), new Version( "1.2.3" ) );
        testVersionComparisonDifferent( new Version( "1.2.3" ), new Version( "1.2" ) );
        testVersionComparisonDifferent( new Version( "1.2.3" ), new Version( "1" ) );
        testVersionComparisonDifferent( new Version( "1.2.3" ), new Version( 1 ) );
    }
View Full Code Here

   
    @Test
   
    public void testVersionEquals()
    {
        testVersionEquals( new Version( 1 ), new Version( "1" ) );
        testVersionEquals( new Version( "1.2.3" ), new Version( "1.2.3" ) );
        testVersionEquals( new Version( "1.2.3" ), new Version( "1.2.3.0.0" ) );
       
        testVersionNotEquals( new Version( "1.2.3" ), new Version( "1.2" ) );
        testVersionNotEquals( new Version( "1.2.3" ), new Version( "4.5.6" ) );
    }
View Full Code Here

   
    @Test

    public void testVersionToString()
    {
        assertEquals( "1", ( new Version( 1 ) ).toString() );
        assertEquals( "1", ( new Version( "1" ) ).toString() );
        assertEquals( "1.2.3", ( new Version( "1.2.3" ) ).toString() );
        assertEquals( "1.2.3.201206260957", ( new Version( "1.2.3.201206260957" ) ).toString() );
        assertEquals( "1.2.3", ( new Version( "1.2.3.0" ) ).toString() );
        assertEquals( "1.2.3", ( new Version( "1.2.3.0.0.0.0" ) ).toString() );
    }
View Full Code Here

   
    public void testSingleVersionConstraint()
    {
        final VersionConstraint constraint = new VersionConstraint( "1.2.3" );
       
        assertTrue( constraint.check( new Version( "1.2.3" ) ) );
        assertTrue( constraint.check( new Version( "1.2.3.0.0" ) ) );
        assertFalse( constraint.check( new Version( "1.2.4" ) ) );
        assertFalse( constraint.check( new Version( "1.2.3.4" ) ) );
    }
View Full Code Here

   
    public void testClosedRangeVersionConstraint1()
    {
        final VersionConstraint constraint = new VersionConstraint( "[1.2.3-1.3)" );
       
        assertTrue( constraint.check( new Version( "1.2.3" ) ) );
        assertTrue( constraint.check( new Version( "1.2.3.0.0" ) ) );
        assertTrue( constraint.check( new Version( "1.2.5" ) ) );
        assertFalse( constraint.check( new Version( "1.3" ) ) );
        assertFalse( constraint.check( new Version( "1.3.0" ) ) );
    }
View Full Code Here

   
    public void testClosedRangeVersionConstraint2()
    {
        final VersionConstraint constraint = new VersionConstraint( "[1.2.3-1.3]" );
       
        assertTrue( constraint.check( new Version( "1.2.3" ) ) );
        assertTrue( constraint.check( new Version( "1.2.3.0.0" ) ) );
        assertTrue( constraint.check( new Version( "1.2.5" ) ) );
        assertTrue( constraint.check( new Version( "1.3" ) ) );
        assertTrue( constraint.check( new Version( "1.3.0" ) ) );
        assertFalse( constraint.check( new Version( "1.3.1" ) ) );
    }
View Full Code Here

    public void testClosedRangeVersionConstraint3()
    {
        final VersionConstraint constraint = new VersionConstraint( "(1.2.3-1.3]" );
       
        assertFalse( constraint.check( new Version( "1.2.3" ) ) );
        assertFalse( constraint.check( new Version( "1.2.3.0.0" ) ) );
        assertTrue( constraint.check( new Version( "1.2.5" ) ) );
        assertTrue( constraint.check( new Version( "1.3" ) ) );
        assertTrue( constraint.check( new Version( "1.3.0" ) ) );
        assertFalse( constraint.check( new Version( "1.3.1" ) ) );
    }
View Full Code Here

    public void testOpenRangeVersionConstraint1()
    {
        final VersionConstraint constraint = new VersionConstraint( "[1.2.3" );
       
        assertFalse( constraint.check( new Version( "0.5.3" ) ) );
        assertFalse( constraint.check( new Version( "1.0" ) ) );
        assertFalse( constraint.check( new Version( "1.2.2" ) ) );
        assertTrue( constraint.check( new Version( "1.2.3" ) ) );
        assertTrue( constraint.check( new Version( "1.2.3.0.0" ) ) );
        assertTrue( constraint.check( new Version( "1.2.5" ) ) );
        assertTrue( constraint.check( new Version( "1.3" ) ) );
        assertTrue( constraint.check( new Version( "2.0" ) ) );
        assertTrue( constraint.check( new Version( "55.0" ) ) );
    }
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.Version

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.